-
Notifications
You must be signed in to change notification settings - Fork 3
/
variables.n3
118 lines (104 loc) · 2.39 KB
/
variables.n3
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
@prefix : <urn:example:> .
# Examples form Dörthe Arndt "Implicit quantification made explicit"
:A a :B , :C.
:Kurt :knows :Alice .
:Kurt :thinks { :Alice :is :Pretty } .
# A blank node means an existential
# If something is a B, then there is something
# (maybe else) that is a B-able
{
[] a :B .
}
=>
{
# vv-* this is a new blank node
[] :is :Bable .
} .
# A blank node can also be named an its scope is limited to
# the parent premisse.
# { SCOPE-A } => { SCOPE-B }
{
_:x a :C .
}
=>
{
# vvv-* this is a new blank node, not _:x in the premisse
_:x :is :Cable .
} .
# A question mark means universal. Its scope
# is the *parent* premisse and conclusion. See next example
# Everyone that Kurt knows also knows Kurt
{
:Kurt :knows ?W .
}
=>
{
?W :knows :Kurt .
} .
# When there is a combination of existentials
# and universals, then the universal is always
# interpreted outside the scope of the existentials
#
# For everyone (y) there is someone (x) that thinks
# that he/she (a member of y) is pretty.
#
# and not
#
# There is someone (x) that thinks everyone (y) is
# pretty.
#
# The scope of ?y is the outer graph plus conclusion
{
_:x :thinks { ?y :is :Pretty } .
}
=>
{
?y :isThoughtAs :Pretty .
} .
# When existentials are nested in the premis of a rule
# their scope is the premis and same for the conclusion.
#
# There is someone (_:x1) that thinks something other
# (_:x2) is Pretty.
{
_:x1 :thinks { _:x2 :is :Pretty } .
}
=>
{
[] :containsPretty true .
} .
# A statement
:ChateauxGreysac a :French , :Wine .
:Badenhortst a :SouthAfrican , :Wine .
:Croissant a :French, :Bread .
# A rule
{ ?X a :Wine } => { ?X :contains :Alcohol } .
# Reasoning about rules..
# One can reason about rules in N3. How should the
# universal ?X be interpreted in the example below?
# Is the scope of ?X in the examples below is limited
# to the inner implications? Or to the outer premisse
# and conclusion. The answer depends on the
# implementation and was the core of Arndt-s research
{
# The ?X here is or not bounded to ...
{ ?X a :Wine } => { ?X :contains :Alcohol }
}
=>
{
# ..the ?X-s here?
{ ?X a :French } => { ?X :needs :ImportTax }
} .
# Test
{
[] :is :Bable .
[] :is :Cable .
:Alice :knows :Kurt .
:Alice :isThoughtAs :Pretty .
[] :containsPretty true .
# Don't test the rules about rules
}
=>
{
:test :is true .
} .