File: command_line.md

package info (click to toggle)
eye 1%3A11.23.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 70,064 kB
  • sloc: perl: 155,303; sh: 890; makefile: 27
file content (130 lines) | stat: -rw-r--r-- 4,342 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
[EYE](https://josd.github.io/images/eye.png)

# Eye command line arguments and flags

This is an introduction into the command line arguments and flags that can be provided to the EYE reasoner.

Running the EYE reasoner requires at least two inputs:

- **data**: a description of the N3 data/rules to execute
- **query**: a description of the output that is expected from the reasoner
  
and optional:

- **options**: flags that influence the execution of the reasoner

Both the **data** and **query** arguments can be command line arguments or flags.

**Data arguments/flags**

Each data input should be one of:

- `<uri>` : the path or a URL to a N3 resource with data/rules
- `--turtle <uri>` : the path or URL to a Turtle resource with data

or, one of the more advanced inputs:

- `--n3p <uri>` : the path or URL to a N3P prolog file (that can be generated with the `--intermediate` flag)
- `--proof <uri>` : the path or URL to N3 proof lemmas 
- `--image <file>` : generate from the input file a new reasoner image (see Image below)

Data inputs can be repeated. For instance, to provide a local and a remote N3 input and one Turtle input one can pass as command line arguments:

```
eye mydata.n3 http://somewhere.org/remote.n3 --turtle file1.ttl
```

**Query flags**

The eye command in the example above doesn't provide any output. Query flags need to be added to create a result output. 

The query flags should be one of:

- `--pass`  : output the deductive closures (all deductions when applying the N3 rules on the datas)
- `--pass-all` : output the deductive closures plus the N3 rules
- `--pass-only-new` : output only the new derived triples (not the original data)
- `--query <uri>` : output should be filtered with the rules in the query filter
     - `--query <uri>` arguments can be repeated

or, one of the more advanced queries:

- `--entail <rdf-graph>` : output true if RDF graph is entailed
- `--not-entail <rdf-graph>` : output true if RDF graph is not entailed
- `--pass-all-ground` : ground the rules and run `--pass-all`

Using one of the flags above these are all valid EYE commands:

```
eye mydata.n3 http://somewhere.org/remote.n3 --turtle file1.ttl --pass

eye mydata.n3 http://somewhere.org/remote.n3 --turtle file1.ttl --pass-all

eye mydata.n3 http://somewhere.org/remote.n3 --turtle file1.ttl --pass-only-new

eye mydata.n3 http://somewhere.org/remote.n3 --query filter1.n3

eye mydata.n3 http://somewhere.org/remote.n3 --query filter1.n3 --query filter2.n3
```

**Options**

These are the most important options that can be provided in every EYE reasoner run:

- `--nope`: skip outputing the proof explanation in the output
- `--quiet`: make the EYE reasoner not verbose
- `--restricted`: run the EYE reasoner in restricted more only allowing core built-ins without side-effects (without network/file access)
- `--strings`: allow the `log:outputString` to output objects on the stdout
- `--intermediate`: output all data and rules as N3P prolog to the standard output (do not calculate any inferences)

Flags that influence the processing of N3 rules:

- `--tactic linear-select` : run the EYE reasoner in a mode where each N3 can only be executed one time
- `--tactic limited-answer <nr>` : give only a limited number of answers

**Full example**

```
eye --nope --quiet \
    mydata.n3 http://somewhere.org/remote.n3 --turtle file1.ttl --pass

eye --nope --quiet --restricted \
    mydata.n3 http://somewhere.org/remote.n3 --query filter1.n3
```

### Image

Use the `--image` option to create a specialized reasoner with a hard coded
context:

```
# Turn all *.n3 files into a `test.pvm` image
eye --nope --quiet --image test.pvm *.n3
```

Run the image on new data:

```
swipl -x test.pvm --nope --quiet --pass newdata.n3
```

### Stack limits

When processing a very large knowledge base the reasoner can reach the 1 GB stack limit. Two options are available to increase this stack limit.

_Build an eye image with a larger stack limit_

In `install.sh` on the line that starts with `swipl` change this into:

```
swipl --stack-limit=4G
```

for a 4 GB stack limit. Rerun the `./install.sh` to create a new eye image.

_Run eye from source_

```
swipl --stack-limit=4G -f ~/github.com/eyereasoner/eye/eye.pl -g main -- "$@"
```

where `"$@"` can be replaced with the usual eye options and arguments.