70 likes | 236 Views
N3. 590SW Stanley Kok. RDF. express in. RDF/XML. N3. What is N3?. Notation 3 3 - <subject> <predicate> <object> triple? “Human-writable” vs RDF/XML – machine-processable expresses the same things as RDF/XML. Easy to Scribble. N3. RDF/XML.
E N D
N3 590SW Stanley Kok
RDF express in RDF/XML N3 What is N3? • Notation 3 • 3 - <subject> <predicate> <object> triple? • “Human-writable” • vs RDF/XML – machine-processable • expresses the same things as RDF/XML
Easy to Scribble N3 RDF/XML <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:m="http://www.example.org/meeting_organization#" xmlns="http://www.example.org/people#" xmlns:p="http://www.example.org/personal_details#"> <rdf:Description about="http://www.example.org/people#fred"> <p:GivenName>Fred</p:GivenName> <p:hasEmail resource="mailto:fred@example.com" /> <m:attending resource="http://meetings.example.com/cal#m1" /> </rdf:Description> </rdf:RDF> @prefix p: <http://www.example.org/personal_details#>. @prefix m: <http://www.example.org/meeting_organization#> . http://www.example.org/people#fred p:GivenName "Fred"; p:hasEmail <mailto:fred@example.com>; m:attending <http://meetings.example.com/cal#m1> .
Syntax • Triple: <subject> <predicate> <object> • URI • Object ~ string • e.g. <#John> <#child> <#Pete>. • <#John> is <#child> a <#Pete>. • [ <#name> “Pete”, <#age> “25” ].
Syntactic Sugar • @prefix dc: <http://sw.org/schema/> • dc:doc dc:title “What is N3?” • prefix : <#> • ‘,’ – another object with same subject and predicate • ‘;’ – another property of same subject • e.g. :john :child :pete, :al; :age “25”.
More Syntax • Class • @prefix rdfs: <http://www.w3.org/rdf-schema#> • :Person a rdfs:Class. :John a :Person • :Man a rdfs:Class; rdfs:subClassOf :Person • Property • @prefix rdfs: <http://www.w3.org/rdf-syntax-ns#> • :brother a rdf:Property • :brother rdfs:domain :Person; rdfs:range :Man • Equivalence • :Man = foo:MaleAdult • Rule • { :per1 :brother [ :father :per2] } log:implies { :per1 :uncle :per 2 }