2011-11
http://www.agfa.com/w3c/Talks/2011/11swig/
by Jos De Roo of AGFA
Logic
* N3Logic * the Semantic Web context in which the research and advanced developments are done
Logic Programming
* the EYE reasoning engine * why/how it is based on Prolog
Advanced Clinical Applications
* concrete cases such as "leg length discrepancy measurement" * large scale projects such as DEBUGIT (Detecting and Eliminating Bacteria UsinG Information Technology)
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 }.
In the current design things are layered and cascaded as follows:
.------------------. .------------|- - - N3S | | PCL |-----'------------| |------------|- - -' YASAM | | YABC |-----'------------| |------------|- - -' YAAM | | ASM |-----'------------| '------------|- - -' CPU | '------------------' Legend ------ N3S = Notation 3 Socket PCL = Prolog Coherent Logic YASAM = Yet Another Skolem Abstract Machine YABC = Yet Another Byte Code YAAM = Yet Another Abstract Machine ASM = Assembly Code CPU = Central Processing Unit
A PCL rule has the general form
A1 , A2 , . . . , Am => C1 | C2 | . . . | Cn (1)
where the Ai are atomic expressions and each Cj is a conjunction of atomic expressions, m, n >= 1. The left-hand side of a rule is called the antecedent of the rule (a conjunction) and the right-hand side is called the consequent (a disjunction). All atomic expressions can contain variables. If n = 1 then there is a single consequent for the rule (1), and the rule is said to be definite. Otherwise the rule is a splitting rule that requires a case distinction (case of C1 or case of C2 or . . . case of Cn). The separate cases (disjuncts) Cj must have a conjunctive form
B1 , B2 , . . . , Bh (2)
where the Bi are atomic expressions, and h >= 1 varies with j. Any free variables occurring in (2) other than those which occurred free in the antecedent of the rule are taken to be existential variables and their scope is this disjunct (2).
Usage: eye <options>* <data>* <query>* eye java -jar Euler.jar [--swipl] [--no-install] yap -q -f euler.yap -g main -- swipl -q -f euler.yap -g main -- <options> --nope no proof explanation --no-branch no branch engine --no-qvars no quantified variables in output --no-qnames no qnames in output --no-span no span control --quiet incomplete e:falseModel explanation --quick-false do not prove all e:falseModel --quick-possible do not prove all e:possibleModel --quick-answer do not prove all answers --think generate e:consistentGives --ances generate e:ancestorModel --plugin <yap_resource> plugin yap_resource --wcache <uri> <file> to tell that uri is cached as file --ignore-syntax-error do not halt in case of syntax error --pcl output PCL code --strings output log:outputString objects --warn output warning info --debug output debug info --profile output profile info --version show version info --help show help info <data> <n3_resource> n3 facts and rules <query> --query <n3_resource> output filtered with filter rules --pass output deductive closure --pass-all output deductive closure plus rules
================================================================= swap/check.py --report for brain anatomy test case http://lists.w3.org/Archives/Public/www-archive/2009Jan/0019.html =================================================================
| colog cwm eye eulerj jdrew jena pellet --------|---------------------------------------------------------------------------- 10 | 0.007 0.071 0.000 0.006 0.004 0.121 0.075 100 | 0.511 1.449 0.004 0.179 0.172 0.783 0.442 1000 | 500.600 115.820 0.040 3.907 98.467 29.330 38.836 10000 | 498137.000 16016.625 0.436 155.710 91614.000 (outOfMem) (outOfMem) 100000 | 16 year 4 sec 4 year
http://ruleml.org/WellnessRules/files/WellnessRulesN3-2009-11-10.pdf
wget -q -O- "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.