All knowledge is just a set of statements
<#pat> <#knows> <#jo> .
### in classical logic: knows(pat,jo)
Here a local URI but could point to ANY document
Verb known as predicate in the statement
<#pat> <#knows> <#jo> . <#pat> <#age> 24 .
Note: noun form "age" preferred to the verb style "knows" for predicates.
<#pat> <#child> <#al>, <#chaz>, <#mo> ;
<#age> 24 ;
<#eyecolor> "blue" .
| age | eyecolor | |
| pat | 24 | blue |
| al | 3 | green |
| jo | 5 | green |
<#pat> <#age> 24; <#eyecolor> "blue" . <#al> <#age> 3; <#eyecolor> "green" . <#jo> <#age> 5; <#eyecolor> "green" .
<#pat> <#child> [ <#age> 4 ] , [ <#age> 3 ].
### in classical logic: ∃x ∃y child(pat,x) ∧ child(pat,y) ∧ age(x,4) ∧ age(y,3)
Note:
[ <#name> "Pat"; <#age> 24; <#eyecolor> "blue" ]. [ <#name> "Al" ; <#age> 3; <#eyecolor> "green" ]. [ <#name> "Jo" ; <#age> 5; <#eyecolor> "green" ].
<> <#title> "A simple example of N3".
Who or what knows what <#title> is?
<> <http://purl.org/dc/elements/1.1/title> "Primer - Getting into the Semantic Web and RDF using N3".
To save space:
@prefix dc: <http://purl.org/dc/elements/1.1/> . <> dc:title "Primer - Getting into the Semantic Web and RDF using N3".
Note
Classes can be the type of an object
rdf:type is just a property, abbrevaiated to
"a" in N3
Equivalent:
:Person rdf:type rdfs:Class :Person a rdfs:Class.
which we could use with data;
:Pat a :Person.
:Woman a rdfs:Class; rdfs:subClassOf :Person .
and a property:
:sister a rdf:Property.
Something about the Property :sister::
:sister rdfs:domain :Person;
rdfs:range :Woman.
Use:
:Pat :sister :Jo.
Convention:
# subject verb object
#============= ========== ==============
{ ?x :son ?y } => { ?y a :Male }.
{ ?x :son ?y } log:implies { ?y a :Male }.
### in classical logic: ∀x ∀y son(x,y) ⇒ male(y)
The terms in braces { } are formulas.
The rule statement relates two formulas.
{ ?x :son ?y.
?y!:age math:lessThan 15 }
=>
{ ?y a :Boy }
{ ?x :son ?y }
=>
{ ?y a :Male.
?y :parent ?x.
?x a :Parent }.
Here are the layers of the EYE stack:

triples cycles | cwm eye jena
| [sec] [sec] [sec]
------------------------|------------------------------------
10,000 1,518 | 15.400 0.420 3.200
100,000 645 | 99.860 2.190 9.310
1,000,000 380 | 1,094.860 21.170 75.380
10,000,000 480 | (OutOfMem) 231.610 853.060
100,000,000 480 | 2,640.580 9,217.800
1,000,000,000 431 | 32,474.540 (OutOfMem)
Test environment:
Linux 4.0.5 x86_64
processor : 0
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 1
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 2
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 3
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
MemTotal: 264163268 kB
Reference:
https://github.com/josd/bmb
depth | cwm eye hermit jdrew jena
| [sec] [sec] [sec] [sec] [sec]
---------------|------------------------------------------------------------
10 | 0.160 0.018 0.055 0.130 0.047
100 | 1.050 0.022 1.040 0.200 0.422
1,000 | 65.930 0.063 3.580 0.870 9.302
10,000 | 7,298.000 0.482 310.510 18.680 2,597.242
100,000 | 732,974.070 4.808 (OutOfMem) 1,875.000 (OutOfMem)
1,000,000 | (848 days) 48.434 (OutOfMem)
Test environment:
Linux 4.0.5 x86_64
processor : 0
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 1
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 2
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 3
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
MemTotal: 264163268 kB
Reference:
http://ruleml.org/WellnessRules/files/WellnessRulesN3-2009-11-10.pdf
length | cwm eye
| [sec] [sec]
---------------|------------------------
2 | 0.188 0.029
4 | 0.371 0.032
8 | 1.004 0.038
16 | 3.504 0.053
32 | 13.968 0.085
64 | 58.689 0.157
128 | 251.361 0.344
256 | 1,081.179 0.936
512 | (MaxRecurs) 2.894
1,024 | 9.764
Test environment:
Linux 4.0.5 x86_64
processor : 0
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 1
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 2
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
processor : 3
model name : Intel(R) Xeon(R) CPU E5-2665 0 @ 2.40GHz
MemTotal: 264163268 kB
Reference:
https://github.com/RubenVerborgh/RESTdesc-Composition-Benchmark
curl "http://eye.restdesc.org?data=http://eulersharp.sourceforge.net/2003/03swap/socrates.n3
&query=http://eulersharp.sourceforge.net/2003/03swap/socratesF.n3"
returns@prefix log: <http://www.w3.org/2000/10/swap/log#>. ... :Socrates a _:Man_1. :Socrates a :Mortal.