23
RDF using N3

RDF using N3

  • Upload
    duke

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

RDF using N3. Subject, Verb and Object. All knowledge is just a set of statements . 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 . - PowerPoint PPT Presentation

Citation preview

Page 1: RDF using N3

RDF using N3

Page 2: 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. The period at the end – very important

Page 3: RDF using N3

Object Can Be Literal

<#pat> <#knows> <#jo> .

<#pat> <#age> "24" .

Note: noun form "age" preferred to the verb style "knows" for predicates

Page 4: RDF using N3

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)

Page 5: RDF using N3

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.

Page 6: RDF using N3

Data …e.g. a table

<#pat> <#age> "24"; <#eyecolor> "blue" .

<#al> <#age> "3"; <#eyecolor> "green" . <#jo> <#age> "5"; <#eyecolor> "green" .

age eyecolor

pat 24 blue

al 3 green

jo 5 green

Page 7: RDF using N3

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" ].

Page 8: RDF using N3

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

Page 9: RDF using N3

Local Concept

<> <#title> "A simple example of N3".

Who or what knows what <#title> is?

Page 10: RDF using N3

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 "#"

Page 11: RDF using N3

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" ].

Page 12: RDF using N3

RDF Conversion

<RDF xmlns="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#" />

Page 13: RDF using N3

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

Page 14: RDF using N3

Cont. Equivalent:

:Person rdf:type rdfs:Class :Person a rdfs:Class.

Which we could use with data::Pat a :Person.

Page 15: RDF using N3

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

Page 16: RDF using N3

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

Page 17: RDF using N3

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 .

Page 18: RDF using N3

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 Pat is a human with the names "Pat Smith" and "Patrick Smith". Pat has a pet, a dog, with the name "Rover".

Page 19: RDF using N3

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" ] .

Page 20: RDF using N3

Directed Labeled Graph

Page 21: RDF using N3

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#">

Page 22: RDF using N3

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>

Page 23: RDF using N3

END