eyeling 1.5.12 → 1.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/examples/age.n3 +29 -0
- package/examples/backward.n3 +24 -0
- package/examples/basic-monadic.n3 +10032 -0
- package/examples/cat-koko.n3 +29 -0
- package/examples/collect-all-in.n3 +32 -0
- package/examples/complex.n3 +142 -0
- package/examples/control-system.n3 +77 -0
- package/examples/crypto-builtins-tests.n3 +60 -0
- package/examples/deep-taxonomy-10.n3 +21 -0
- package/examples/deep-taxonomy-100.n3 +111 -0
- package/examples/deep-taxonomy-1000.n3 +1011 -0
- package/examples/deep-taxonomy-10000.n3 +10011 -0
- package/examples/derived-backward-rule-2.n3 +28 -0
- package/examples/derived-backward-rule.n3 +32 -0
- package/examples/derived-rule.n3 +19 -0
- package/examples/dijkstra.n3 +64 -0
- package/examples/dog.n3 +21 -0
- package/examples/equals.n3 +12 -0
- package/examples/existential-rule.n3 +18 -0
- package/examples/fibonacci.n3 +34 -0
- package/examples/for-all-in.n3 +21 -0
- package/examples/french-cities.n3 +32 -0
- package/examples/fuse.n3 +13 -0
- package/examples/good-cobbler.n3 +18 -0
- package/examples/gray-code-counter.n3 +64 -0
- package/examples/hanoi.n3 +21 -0
- package/examples/liar.n3 +6 -0
- package/examples/list-builtins-tests.n3 +84 -0
- package/examples/lldm.n3 +133 -0
- package/examples/math-builtins-tests.n3 +612 -0
- package/examples/monkey.n3 +11 -0
- package/examples/output/age.n3 +20 -0
- package/examples/output/backward.n3 +18 -0
- package/examples/output/basic-monadic.n3 +122 -0
- package/examples/output/cat-koko.n3 +125 -0
- package/examples/output/collect-all-in.n3 +122 -0
- package/examples/output/complex.n3 +57 -0
- package/examples/output/control-system.n3 +79 -0
- package/examples/output/crypto-builtins-tests.n3 +66 -0
- package/examples/output/deep-taxonomy-10.n3 +636 -0
- package/examples/output/deep-taxonomy-100.n3 +6036 -0
- package/examples/output/deep-taxonomy-1000.n3 +60036 -0
- package/examples/output/deep-taxonomy-10000.n3 +600036 -0
- package/examples/output/derived-backward-rule-2.n3 +71 -0
- package/examples/output/derived-backward-rule.n3 +53 -0
- package/examples/output/derived-rule.n3 +52 -0
- package/examples/output/dijkstra.n3 +315 -0
- package/examples/output/dog.n3 +33 -0
- package/examples/output/equals.n3 +18 -0
- package/examples/output/existential-rule.n3 +38 -0
- package/examples/output/fibonacci.n3 +44 -0
- package/examples/output/for-all-in.n3 +30 -0
- package/examples/output/french-cities.n3 +507 -0
- package/examples/output/fuse.n3 +1 -0
- package/examples/output/good-cobbler.n3 +27 -0
- package/examples/output/gray-code-counter.n3 +20 -0
- package/examples/output/hanoi.n3 +20 -0
- package/examples/output/liar.n3 +1 -0
- package/examples/output/list-builtins-tests.n3 +148 -0
- package/examples/output/lldm.n3 +1000 -0
- package/examples/output/math-builtins-tests.n3 +4479 -0
- package/examples/output/monkey.n3 +40 -0
- package/examples/output/peano.n3 +26 -0
- package/examples/output/pi.n3 +20 -0
- package/examples/output/polygon.n3 +20 -0
- package/examples/output/reordering.n3 +29 -0
- package/examples/output/rule-matching.n3 +29 -0
- package/examples/output/self-referential.n3 +88 -0
- package/examples/output/similar.n3 +18 -0
- package/examples/output/skolem.n3 +20 -0
- package/examples/output/snaf.n3 +26 -0
- package/examples/output/socrates.n3 +24 -0
- package/examples/output/string-builtins-tests.n3 +258 -0
- package/examples/output/turing.n3 +44 -0
- package/examples/output/uri.n3 +46 -0
- package/examples/output/witch.n3 +115 -0
- package/examples/output/zebra.n3 +114 -0
- package/examples/peano.n3 +45 -0
- package/examples/pi.n3 +32 -0
- package/examples/polygon.n3 +26 -0
- package/examples/reordering.n3 +23 -0
- package/examples/rule-matching.n3 +15 -0
- package/examples/self-referential.n3 +32 -0
- package/examples/similar.n3 +28 -0
- package/examples/skolem.n3 +15 -0
- package/examples/snaf.n3 +18 -0
- package/examples/socrates.n3 +19 -0
- package/examples/string-builtins-tests.n3 +210 -0
- package/examples/test +154 -0
- package/examples/turing.n3 +93 -0
- package/examples/uri.n3 +17 -0
- package/examples/witch.n3 +33 -0
- package/examples/zebra.n3 +47 -0
- package/package.json +7 -2
- package/test/api.test.js +22 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@prefix : <http://example.org/> .
|
|
2
|
+
|
|
3
|
+
# ----------------------------------------------------------------------
|
|
4
|
+
# Proof for derived triple:
|
|
5
|
+
# :uriString :is "https://www.w3.org" .
|
|
6
|
+
# It holds because the following instance of the rule body is provable:
|
|
7
|
+
# <https://www.w3.org> log:uri "https://www.w3.org" .
|
|
8
|
+
# <https://www.w3.org> log:uri "https://www.w3.org" .
|
|
9
|
+
# via the schematic forward rule:
|
|
10
|
+
# {
|
|
11
|
+
# <https://www.w3.org> log:uri ?s .
|
|
12
|
+
# ?r log:uri "https://www.w3.org" .
|
|
13
|
+
# } => {
|
|
14
|
+
# :uriString :is ?s .
|
|
15
|
+
# :uriResource :is ?r .
|
|
16
|
+
# } .
|
|
17
|
+
# with substitution (on rule variables):
|
|
18
|
+
# ?r = <https://www.w3.org>
|
|
19
|
+
# ?s = "https://www.w3.org"
|
|
20
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
21
|
+
# ----------------------------------------------------------------------
|
|
22
|
+
|
|
23
|
+
:uriString :is "https://www.w3.org" .
|
|
24
|
+
|
|
25
|
+
# ----------------------------------------------------------------------
|
|
26
|
+
# Proof for derived triple:
|
|
27
|
+
# :uriResource :is <https://www.w3.org> .
|
|
28
|
+
# It holds because the following instance of the rule body is provable:
|
|
29
|
+
# <https://www.w3.org> log:uri "https://www.w3.org" .
|
|
30
|
+
# <https://www.w3.org> log:uri "https://www.w3.org" .
|
|
31
|
+
# via the schematic forward rule:
|
|
32
|
+
# {
|
|
33
|
+
# <https://www.w3.org> log:uri ?s .
|
|
34
|
+
# ?r log:uri "https://www.w3.org" .
|
|
35
|
+
# } => {
|
|
36
|
+
# :uriString :is ?s .
|
|
37
|
+
# :uriResource :is ?r .
|
|
38
|
+
# } .
|
|
39
|
+
# with substitution (on rule variables):
|
|
40
|
+
# ?r = <https://www.w3.org>
|
|
41
|
+
# ?s = "https://www.w3.org"
|
|
42
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
43
|
+
# ----------------------------------------------------------------------
|
|
44
|
+
|
|
45
|
+
:uriResource :is <https://www.w3.org> .
|
|
46
|
+
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
@prefix : <https://eyereasoner.github.io/eye/reasoning/witch#> .
|
|
2
|
+
|
|
3
|
+
# ----------------------------------------------------------------------
|
|
4
|
+
# Proof for derived triple:
|
|
5
|
+
# :DUCK a :ISMADEOFWOOD .
|
|
6
|
+
# It holds because the following instance of the rule body is provable:
|
|
7
|
+
# :DUCK a :FLOATS .
|
|
8
|
+
# via the schematic forward rule:
|
|
9
|
+
# {
|
|
10
|
+
# ?x a :FLOATS .
|
|
11
|
+
# } => {
|
|
12
|
+
# ?x a :ISMADEOFWOOD .
|
|
13
|
+
# } .
|
|
14
|
+
# with substitution (on rule variables):
|
|
15
|
+
# ?x = :DUCK
|
|
16
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
17
|
+
# ----------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
:DUCK a :ISMADEOFWOOD .
|
|
20
|
+
|
|
21
|
+
# ----------------------------------------------------------------------
|
|
22
|
+
# Proof for derived triple:
|
|
23
|
+
# :GIRL a :FLOATS .
|
|
24
|
+
# It holds because the following instance of the rule body is provable:
|
|
25
|
+
# :DUCK a :FLOATS .
|
|
26
|
+
# :DUCK :SAMEWEIGHT :GIRL .
|
|
27
|
+
# via the schematic forward rule:
|
|
28
|
+
# {
|
|
29
|
+
# ?x a :FLOATS .
|
|
30
|
+
# ?x :SAMEWEIGHT ?y .
|
|
31
|
+
# } => {
|
|
32
|
+
# ?y a :FLOATS .
|
|
33
|
+
# } .
|
|
34
|
+
# with substitution (on rule variables):
|
|
35
|
+
# ?x = :DUCK
|
|
36
|
+
# ?y = :GIRL
|
|
37
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
38
|
+
# ----------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
:GIRL a :FLOATS .
|
|
41
|
+
|
|
42
|
+
# ----------------------------------------------------------------------
|
|
43
|
+
# Proof for derived triple:
|
|
44
|
+
# :DUCK a :BURNS .
|
|
45
|
+
# It holds because the following instance of the rule body is provable:
|
|
46
|
+
# :DUCK a :ISMADEOFWOOD .
|
|
47
|
+
# via the schematic forward rule:
|
|
48
|
+
# {
|
|
49
|
+
# ?x a :ISMADEOFWOOD .
|
|
50
|
+
# } => {
|
|
51
|
+
# ?x a :BURNS .
|
|
52
|
+
# } .
|
|
53
|
+
# with substitution (on rule variables):
|
|
54
|
+
# ?x = :DUCK
|
|
55
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
56
|
+
# ----------------------------------------------------------------------
|
|
57
|
+
|
|
58
|
+
:DUCK a :BURNS .
|
|
59
|
+
|
|
60
|
+
# ----------------------------------------------------------------------
|
|
61
|
+
# Proof for derived triple:
|
|
62
|
+
# :GIRL a :ISMADEOFWOOD .
|
|
63
|
+
# It holds because the following instance of the rule body is provable:
|
|
64
|
+
# :GIRL a :FLOATS .
|
|
65
|
+
# via the schematic forward rule:
|
|
66
|
+
# {
|
|
67
|
+
# ?x a :FLOATS .
|
|
68
|
+
# } => {
|
|
69
|
+
# ?x a :ISMADEOFWOOD .
|
|
70
|
+
# } .
|
|
71
|
+
# with substitution (on rule variables):
|
|
72
|
+
# ?x = :GIRL
|
|
73
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
74
|
+
# ----------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
:GIRL a :ISMADEOFWOOD .
|
|
77
|
+
|
|
78
|
+
# ----------------------------------------------------------------------
|
|
79
|
+
# Proof for derived triple:
|
|
80
|
+
# :GIRL a :BURNS .
|
|
81
|
+
# It holds because the following instance of the rule body is provable:
|
|
82
|
+
# :GIRL a :ISMADEOFWOOD .
|
|
83
|
+
# via the schematic forward rule:
|
|
84
|
+
# {
|
|
85
|
+
# ?x a :ISMADEOFWOOD .
|
|
86
|
+
# } => {
|
|
87
|
+
# ?x a :BURNS .
|
|
88
|
+
# } .
|
|
89
|
+
# with substitution (on rule variables):
|
|
90
|
+
# ?x = :GIRL
|
|
91
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
92
|
+
# ----------------------------------------------------------------------
|
|
93
|
+
|
|
94
|
+
:GIRL a :BURNS .
|
|
95
|
+
|
|
96
|
+
# ----------------------------------------------------------------------
|
|
97
|
+
# Proof for derived triple:
|
|
98
|
+
# :GIRL a :WITCH .
|
|
99
|
+
# It holds because the following instance of the rule body is provable:
|
|
100
|
+
# :GIRL a :BURNS .
|
|
101
|
+
# :GIRL a :WOMAN .
|
|
102
|
+
# via the schematic forward rule:
|
|
103
|
+
# {
|
|
104
|
+
# ?x a :BURNS .
|
|
105
|
+
# ?x a :WOMAN .
|
|
106
|
+
# } => {
|
|
107
|
+
# ?x a :WITCH .
|
|
108
|
+
# } .
|
|
109
|
+
# with substitution (on rule variables):
|
|
110
|
+
# ?x = :GIRL
|
|
111
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
112
|
+
# ----------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
:GIRL a :WITCH .
|
|
115
|
+
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@prefix : <http://eulersharp.sourceforge.net/2005/11swap/zebra#> .
|
|
2
|
+
|
|
3
|
+
# ----------------------------------------------------------------------
|
|
4
|
+
# Proof for derived triple:
|
|
5
|
+
# :german :eats :fish .
|
|
6
|
+
# It holds because the following instance of the rule body is provable:
|
|
7
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) log:equalTo ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) .
|
|
8
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) :pair ((:blue :dane :horse :tea :blends) (:yellow :norwegian :cats :water :dunhill)) .
|
|
9
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) :pair ((:blue :dane :horse :tea :blends) (:yellow :norwegian :cats :water :dunhill)) .
|
|
10
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) :sublist ((:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) .
|
|
11
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) :pair ((:blue :dane :horse :tea :blends) (:yellow :norwegian :cats :water :dunhill)) .
|
|
12
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:red :brit :birds :milk :pallmall) .
|
|
13
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:white :swede :dogs :beer :bluemasters) .
|
|
14
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:blue :dane :horse :tea :blends) .
|
|
15
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:red :brit :birds :milk :pallmall) .
|
|
16
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:yellow :norwegian :cats :water :dunhill) .
|
|
17
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:white :swede :dogs :beer :bluemasters) .
|
|
18
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:green :german :fish :coffee :prince) .
|
|
19
|
+
# ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters)) list:member (:green :german :fish :coffee :prince) .
|
|
20
|
+
# via the schematic forward rule:
|
|
21
|
+
# {
|
|
22
|
+
# ?L log:equalTo ((?A1 :norwegian ?A2 ?A3 ?A4) (:blue ?A5 ?A6 ?A7 ?A8) (?A9 ?A10 ?A11 :milk ?A12) ?A13 ?A14) .
|
|
23
|
+
# ?L :pair ((?A15 ?A16 ?A17 ?A18 :blends) (?A19 ?A20 :cats ?A21 ?A22)) .
|
|
24
|
+
# ?L :pair ((?A23 ?A24 :horse ?A25 ?A26) (?A27 ?A28 ?A29 ?A30 :dunhill)) .
|
|
25
|
+
# ?L :sublist ((:green ?A31 ?A32 :coffee ?A33) (:white ?A34 ?A35 ?A36 ?A37)) .
|
|
26
|
+
# ?L :pair ((?A38 ?A39 ?A40 ?A41 :blends) (?A42 ?A43 ?A44 :water ?A45)) .
|
|
27
|
+
# ?L list:member (:red :brit ?A46 ?A47 ?A48) .
|
|
28
|
+
# ?L list:member (?A49 :swede :dogs ?A50 ?A51) .
|
|
29
|
+
# ?L list:member (?A52 :dane ?A53 :tea ?A54) .
|
|
30
|
+
# ?L list:member (?A55 ?A56 :birds ?A57 :pallmall) .
|
|
31
|
+
# ?L list:member (:yellow ?A58 ?A59 ?A60 :dunhill) .
|
|
32
|
+
# ?L list:member (?A61 ?A62 ?A63 :beer :bluemasters) .
|
|
33
|
+
# ?L list:member (?A64 :german ?A65 ?A66 :prince) .
|
|
34
|
+
# ?L list:member (?A67 ?B :fish ?A69 ?A70) .
|
|
35
|
+
# } => {
|
|
36
|
+
# ?B :eats :fish .
|
|
37
|
+
# } .
|
|
38
|
+
# with substitution (on rule variables):
|
|
39
|
+
# ?A1 = :yellow
|
|
40
|
+
# ?A10 = :brit
|
|
41
|
+
# ?A11 = :birds
|
|
42
|
+
# ?A12 = :pallmall
|
|
43
|
+
# ?A13 = (:green :german :fish :coffee :prince)
|
|
44
|
+
# ?A14 = (:white :swede :dogs :beer :bluemasters)
|
|
45
|
+
# ?A15 = :blue
|
|
46
|
+
# ?A16 = :dane
|
|
47
|
+
# ?A17 = :horse
|
|
48
|
+
# ?A18 = :tea
|
|
49
|
+
# ?A19 = :yellow
|
|
50
|
+
# ?A2 = :cats
|
|
51
|
+
# ?A20 = :norwegian
|
|
52
|
+
# ?A21 = :water
|
|
53
|
+
# ?A22 = :dunhill
|
|
54
|
+
# ?A23 = :blue
|
|
55
|
+
# ?A24 = :dane
|
|
56
|
+
# ?A25 = :tea
|
|
57
|
+
# ?A26 = :blends
|
|
58
|
+
# ?A27 = :yellow
|
|
59
|
+
# ?A28 = :norwegian
|
|
60
|
+
# ?A29 = :cats
|
|
61
|
+
# ?A3 = :water
|
|
62
|
+
# ?A30 = :water
|
|
63
|
+
# ?A31 = :german
|
|
64
|
+
# ?A32 = :fish
|
|
65
|
+
# ?A33 = :prince
|
|
66
|
+
# ?A34 = :swede
|
|
67
|
+
# ?A35 = :dogs
|
|
68
|
+
# ?A36 = :beer
|
|
69
|
+
# ?A37 = :bluemasters
|
|
70
|
+
# ?A38 = :blue
|
|
71
|
+
# ?A39 = :dane
|
|
72
|
+
# ?A4 = :dunhill
|
|
73
|
+
# ?A40 = :horse
|
|
74
|
+
# ?A41 = :tea
|
|
75
|
+
# ?A42 = :yellow
|
|
76
|
+
# ?A43 = :norwegian
|
|
77
|
+
# ?A44 = :cats
|
|
78
|
+
# ?A45 = :dunhill
|
|
79
|
+
# ?A46 = :birds
|
|
80
|
+
# ?A47 = :milk
|
|
81
|
+
# ?A48 = :pallmall
|
|
82
|
+
# ?A49 = :white
|
|
83
|
+
# ?A5 = :dane
|
|
84
|
+
# ?A50 = :beer
|
|
85
|
+
# ?A51 = :bluemasters
|
|
86
|
+
# ?A52 = :blue
|
|
87
|
+
# ?A53 = :horse
|
|
88
|
+
# ?A54 = :blends
|
|
89
|
+
# ?A55 = :red
|
|
90
|
+
# ?A56 = :brit
|
|
91
|
+
# ?A57 = :milk
|
|
92
|
+
# ?A58 = :norwegian
|
|
93
|
+
# ?A59 = :cats
|
|
94
|
+
# ?A6 = :horse
|
|
95
|
+
# ?A60 = :water
|
|
96
|
+
# ?A61 = :white
|
|
97
|
+
# ?A62 = :swede
|
|
98
|
+
# ?A63 = :dogs
|
|
99
|
+
# ?A64 = :green
|
|
100
|
+
# ?A65 = :fish
|
|
101
|
+
# ?A66 = :coffee
|
|
102
|
+
# ?A67 = :green
|
|
103
|
+
# ?A69 = :coffee
|
|
104
|
+
# ?A7 = :tea
|
|
105
|
+
# ?A70 = :prince
|
|
106
|
+
# ?A8 = :blends
|
|
107
|
+
# ?A9 = :red
|
|
108
|
+
# ?B = :german
|
|
109
|
+
# ?L = ((:yellow :norwegian :cats :water :dunhill) (:blue :dane :horse :tea :blends) (:red :brit :birds :milk :pallmall) (:green :german :fish :coffee :prince) (:white :swede :dogs :beer :bluemasters))
|
|
110
|
+
# Therefore the derived triple above is entailed by the rules and facts.
|
|
111
|
+
# ----------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
:german :eats :fish .
|
|
114
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# ----------------
|
|
2
|
+
# Peano arithmetic
|
|
3
|
+
# ----------------
|
|
4
|
+
#
|
|
5
|
+
# See https://en.wikipedia.org/wiki/Peano_axioms
|
|
6
|
+
|
|
7
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
8
|
+
@prefix : <http://example.org/#>.
|
|
9
|
+
|
|
10
|
+
# add
|
|
11
|
+
{(?A 0) :add ?A} <= true.
|
|
12
|
+
|
|
13
|
+
{(?A (:s ?B)) :add (:s ?C)} <= {
|
|
14
|
+
(?A ?B) :add ?C.
|
|
15
|
+
}.
|
|
16
|
+
|
|
17
|
+
# multiply
|
|
18
|
+
{(?A 0) :multiply 0} <= true.
|
|
19
|
+
|
|
20
|
+
{(?A (:s ?B)) :multiply ?C} <= {
|
|
21
|
+
(?A ?B) :multiply ?D.
|
|
22
|
+
(?A ?D) :add ?C.
|
|
23
|
+
}.
|
|
24
|
+
|
|
25
|
+
# factorial
|
|
26
|
+
{?A :factorial ?B} <= {
|
|
27
|
+
(?A (:s 0)) :fac ?B.
|
|
28
|
+
}.
|
|
29
|
+
|
|
30
|
+
{(0 ?A) :fac ?A} <= true.
|
|
31
|
+
|
|
32
|
+
{((:s ?A) ?B) :fac ?C} <= {
|
|
33
|
+
(?B (:s ?A)) :multiply ?D.
|
|
34
|
+
(?A ?D) :fac ?C.
|
|
35
|
+
}.
|
|
36
|
+
|
|
37
|
+
# derivation
|
|
38
|
+
{
|
|
39
|
+
((:s 0) (:s (:s 0))) :multiply ?A.
|
|
40
|
+
(?A (:s (:s (:s 0)))) :add ?B.
|
|
41
|
+
?B :factorial ?C.
|
|
42
|
+
} => {
|
|
43
|
+
?B :peanoFactorial ?C.
|
|
44
|
+
}.
|
|
45
|
+
|
package/examples/pi.n3
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ------------------------------------
|
|
2
|
+
# Calculate pi using Nilakantha series
|
|
3
|
+
# ------------------------------------
|
|
4
|
+
#
|
|
5
|
+
# See http://www.wikihow.com/Calculate-Pi
|
|
6
|
+
|
|
7
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
8
|
+
@prefix : <https://eyereasoner.github.io/eye/reasoning#>.
|
|
9
|
+
|
|
10
|
+
{ (?N ?Pi) :pi true } <= {
|
|
11
|
+
(1 ?N 0 ?P 1) :pi true.
|
|
12
|
+
(4 ?P) math:product ?A.
|
|
13
|
+
(3 ?A) math:sum ?Pi.
|
|
14
|
+
}.
|
|
15
|
+
|
|
16
|
+
{ (?N ?N ?P ?P ?S) :pi true } <= true.
|
|
17
|
+
|
|
18
|
+
{ (?K ?N ?P0 ?P ?S) :pi true } <= {
|
|
19
|
+
?K math:notEqualTo ?N.
|
|
20
|
+
(?K 1) math:sum ?K1.
|
|
21
|
+
(2 ?K) math:product ?K2.
|
|
22
|
+
(?K2 1) math:sum ?Z1.
|
|
23
|
+
(?K2 2) math:sum ?Z2.
|
|
24
|
+
(?K2 ?Z1 ?Z2) math:product ?Z3.
|
|
25
|
+
(?S ?Z3) math:quotient ?Z4.
|
|
26
|
+
(?P0 ?Z4) math:sum ?P1.
|
|
27
|
+
?S math:negation ?S1.
|
|
28
|
+
(?K1 ?N ?P1 ?P ?S1) :pi true.
|
|
29
|
+
}.
|
|
30
|
+
|
|
31
|
+
# test
|
|
32
|
+
{ (100 ?Pi) :pi true } => { (100 ?Pi) :pi true }.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# -------
|
|
2
|
+
# Polygon
|
|
3
|
+
# -------
|
|
4
|
+
#
|
|
5
|
+
# Calculate the area of a polygon.
|
|
6
|
+
# See https://www.mathopenref.com/coordpolygonarea.html
|
|
7
|
+
|
|
8
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
9
|
+
@prefix list: <http://www.w3.org/2000/10/swap/list#>.
|
|
10
|
+
@prefix polygon: <https://eyereasoner.github.io/eye/reasoning/polygon#>.
|
|
11
|
+
|
|
12
|
+
# calculating the area of a polygon
|
|
13
|
+
{ (?POINT) polygon:area 0 } <= true.
|
|
14
|
+
{ ?POINTS polygon:area ?AREA } <= {
|
|
15
|
+
?POINTS list:firstRest ((?X1 ?Y1) ?POINTS1).
|
|
16
|
+
?POINTS1 list:firstRest ((?X2 ?Y2) ?POINTS2).
|
|
17
|
+
?POINTS1 polygon:area ?AREA1.
|
|
18
|
+
(?X1 ?Y2) math:product ?Z1.
|
|
19
|
+
(?Y1 ?X2) math:product ?Z2.
|
|
20
|
+
(?Z1 ?Z2) math:difference ?Z3.
|
|
21
|
+
(?Z3 2) math:quotient ?Z4.
|
|
22
|
+
(?Z4 ?AREA1) math:sum ?AREA.
|
|
23
|
+
}.
|
|
24
|
+
|
|
25
|
+
# test
|
|
26
|
+
{ ((4 2) (6 2) (7 6) (4 6) (5 5) (5 3) (4 2)) polygon:area ?AREA } => { ((4 2) (6 2) (7 6) (4 6) (5 5) (5 3) (4 2)) polygon:area ?AREA }.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# --------------------------
|
|
2
|
+
# Premise reordering example
|
|
3
|
+
# --------------------------
|
|
4
|
+
#
|
|
5
|
+
# Example from Patrick Hochstenbach
|
|
6
|
+
|
|
7
|
+
@prefix : <https://eyereasoner.github.io/ns#>.
|
|
8
|
+
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
|
|
9
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
10
|
+
|
|
11
|
+
:Alice :has (:Book 1).
|
|
12
|
+
:Bob :has (:Table 1).
|
|
13
|
+
|
|
14
|
+
{
|
|
15
|
+
?O1 log:notEqualTo ?O2.
|
|
16
|
+
|
|
17
|
+
?W1 :has (?O1 ?N1).
|
|
18
|
+
?W2 :has (?O2 ?N2).
|
|
19
|
+
}
|
|
20
|
+
=>
|
|
21
|
+
{
|
|
22
|
+
:test :is true .
|
|
23
|
+
}.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# ----------------
|
|
2
|
+
# Self referential
|
|
3
|
+
# ----------------
|
|
4
|
+
#
|
|
5
|
+
# Example from Patrick Hochstenbach
|
|
6
|
+
|
|
7
|
+
@prefix : <https://eyereasoner.github.io/ns#>.
|
|
8
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
9
|
+
|
|
10
|
+
{
|
|
11
|
+
?X ?Y ?Z
|
|
12
|
+
}
|
|
13
|
+
=>
|
|
14
|
+
{
|
|
15
|
+
:answer :contains ?Y
|
|
16
|
+
}.
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
?X => ?Z
|
|
20
|
+
}
|
|
21
|
+
=>
|
|
22
|
+
{
|
|
23
|
+
:answer :contains log:implies.
|
|
24
|
+
}.
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
:answer :contains :contains, log:implies .
|
|
28
|
+
}
|
|
29
|
+
=>
|
|
30
|
+
{
|
|
31
|
+
:test :is true
|
|
32
|
+
}.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# -------
|
|
2
|
+
# Similar
|
|
3
|
+
# -------
|
|
4
|
+
#
|
|
5
|
+
# Example from Patrick Hochstenbach
|
|
6
|
+
|
|
7
|
+
@prefix : <https://eyereasoner.github.io/ns#>.
|
|
8
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
9
|
+
|
|
10
|
+
:Alice a :Human .
|
|
11
|
+
:Bob a :Human .
|
|
12
|
+
|
|
13
|
+
{
|
|
14
|
+
:Alice :similar :Bob .
|
|
15
|
+
}
|
|
16
|
+
=>
|
|
17
|
+
{
|
|
18
|
+
:test :is true .
|
|
19
|
+
}.
|
|
20
|
+
|
|
21
|
+
{
|
|
22
|
+
?A :similar ?B .
|
|
23
|
+
}
|
|
24
|
+
<=
|
|
25
|
+
{
|
|
26
|
+
?A ?Pred ?Obj .
|
|
27
|
+
?B ?Pred ?Obj .
|
|
28
|
+
}.
|
package/examples/snaf.n3
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# --------------------------
|
|
2
|
+
# Scoped Negation As Failure
|
|
3
|
+
# --------------------------
|
|
4
|
+
|
|
5
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
|
|
6
|
+
@prefix : <http://example.org/>.
|
|
7
|
+
|
|
8
|
+
:Alice :loves :Bob.
|
|
9
|
+
:Bob a :Person.
|
|
10
|
+
|
|
11
|
+
{
|
|
12
|
+
?SCOPE log:notIncludes { :Alice :hates ?X }.
|
|
13
|
+
?X a :Person.
|
|
14
|
+
}
|
|
15
|
+
=>
|
|
16
|
+
{
|
|
17
|
+
:Alice :hates :Nobody.
|
|
18
|
+
}.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# ------------------
|
|
2
|
+
# Socrates inference
|
|
3
|
+
# ------------------
|
|
4
|
+
|
|
5
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
|
|
6
|
+
@prefix : <http://example.org/socrates#>.
|
|
7
|
+
|
|
8
|
+
# facts
|
|
9
|
+
:Socrates a :Human.
|
|
10
|
+
:Human rdfs:subClassOf :Mortal.
|
|
11
|
+
|
|
12
|
+
# subclass rule
|
|
13
|
+
{
|
|
14
|
+
?S a ?A.
|
|
15
|
+
?A rdfs:subClassOf ?B.
|
|
16
|
+
} => {
|
|
17
|
+
?S a ?B.
|
|
18
|
+
}.
|
|
19
|
+
|