1 / 23

RDF using N3

RDF using N3. Subject, Verb and Object. All knowledge is just a set of statements <#pat> <#knows> <#jo> . Everything is identified by URI Here a local URI but could point to ANY document Verb known as predicate in the statement and represents a Property .

duke
Download Presentation

RDF using N3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. RDF using N3

  2. Subject, Verb and Object All knowledge is just a set of statements <#pat> <#knows> <#jo> . • Everything is identified by URI • Here a local URI but could point to ANY document • Verb known as predicate in the statement and represents a Property. • The period at the end – very important

  3. Object Can Be Literal <#pat> <#knows> <#jo> . <#pat> <#age> "24" . • Note: noun form "age" preferred to the verb style "knows" for predicates

  4. Alternative Forms <#pat> has <#child> <#al> . • Just to make reading easier; no meaning <#al> is <#child> of <#pat> . • is and of reverse the direction • Saves having inverse relationships for everything (eg parent)

  5. Comma and Semicolon <#pat> <#child> <#al>, <#chaz>, <#mo> ; <#age> "24" ; <#eyecolor> "blue" . • Comma: delimits multiple objects for same subject & predicate • Semicolon: delimits multiple predicates for same subject. • Aim? Easy scribbling of data.

  6. Data …e.g. a table <#pat> <#age> "24"; <#eyecolor> "blue" . <#al> <#age> "3"; <#eyecolor> "green" . <#jo> <#age> "5"; <#eyecolor> "green" .

  7. Unnamed Things: Square Brackets <#pat> <#child> [ <#age> "4" ] , [ <#age> "3" ]. • Words used as IDs have no actual meaning • Unnamed nodes can't be used elsewhere • ID things are names; make the name explicit [ <#name> "Pat"; <#age> "24"; <#eyecolor> "blue" ]. [ <#name> "Al" ; <#age> "3"; <#eyecolor> "green" ]. [ <#name> "Jo" ; <#age> "5"; <#eyecolor> "green" ].

  8. Sharing Concepts • Using the same URIs is effort but valuable • For anything -- including predicates • URIs tend to be long so we use namespaces • Writing authoritative documents about shared concepts is useful

  9. Local Concept <> <#title> "A simple example of N3". • Who or what knows what <#title> is?

  10. Shared Concept <http://purl.org/dc/elements/1.1/title> "Primer - Getting into the Semantic Web and RDF using N3". @prefix dc: <http://purl.org/dc/elements/1.1/> . <> dc:title "Primer - Getting into the Semantic Web and RDF using N3". • No <> used when prefixed identifier • Typically prefix stands for everything up to including a "#"

  11. Assumed Prefixes • In this tutorial: @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . • and also @prefix : <#> . • e.g. :pat :child [ :age "4" ] , [ :age "3" ].

  12. RDF Conversion <RDFxmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-s#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" />

  13. Making Vocabularies • A set of shared concepts • Properties are things to use as predicates (verbs) • Classes can be the type of an object • rdf:type is just a property, abbreviated to "a" in N3

  14. Cont. • Equivalent: :Person rdf:type rdfs:Class :Person a rdfs:Class. • Which we could use with data: :Pat a :Person.

  15. Classes • An object can be in many classes • Classes can have many superclasses • You can never know all the classes an object is in • These are classes of real things, not OO classes

  16. Examples: class and property :Woman a rdfs:Class; rdfs:subClassOf :Person . :sister a rdf:Property. • Something about the Property :sister:: :sister rdfs:domain :Person; rdfs:range :Woman. • Use: • :Pat :sister :Jo. • Class ids start with capital, Propoerty ids with lowercase

  17. Best Practice • Use other people's terms when you can • Use your own when you need to • Be prepared to declare them equivalent later • = in N3 is short for owl:equivalentTo :Woman = foo:FemaleAdult . :title a rdf:Property; = dc:title .

  18. Examples • English (Very Informal): There is person, Pat, known as "Pat Smith" and "Patrick Smith". Pat has a pet dog named "Rover". • English Hypertext (Informal): • Ambiguity of terms is removed by links Patis ahuman with the names "Pat Smith" and "Patrick Smith". Pat has a pet, adog, with the name "Rover".

  19. N3 @prefix : <http://www.w3.org/2000/10/swap/test/demo1/about-pat#> . @prefix bio: <http://www.w3.org/2000/10/swap/test/demo1/biology#> . @prefix per: <http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#> . :pat a bio:Human; per:name "Pat Smith", "Patrick Smith"; per: pet [ a bio:Dog; per:name "Rover" ] .

  20. Directed Labeled Graph

  21. RDF Translation <rdf:RDF xmlns="http://www.w3.org/2000/10/swap/test/demo1/about-pat#" xmlns:bio="http://www.w3.org/2000/10/swap/test/demo1/biology#" xmlns:per="http://www.w3.org/2000/10/swap/test/demo1/friends-vocab#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

  22. Cont. <bio:Human rdf:about="#pat"> <per:name>Pat Smith</per:name> <per:name>Patrick Smith</per:name> <per:pet> <bio:Dog> <per:name>Rover</per:name> </bio:Dog> </per:pet> </bio:Human> </rdf:RDF>

  23. END

More Related