Documente Academic
Documente Profesional
Documente Cultură
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
Schema
RDF Schema
Data
RDF
! W3C recommendations
-! Model -! Syntax -! Semantics
Ral Garca Castro et al. 3
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
RDF statements
! ! Also known as triples
-! [Subject, Predicate, Object]
26 December 1975
http://www.oeg-upm.net/
6
RDF graphs
! RDF graphs are sets of triples
Ral
has birth date is member of has web page
26 December 1975
http://www.oeg-upm.net/
RDF literals
! Triple objects can be literals (character strings)
-! Subject and predicates are always resources
Ral
has birth date is member of has web page
1975-12-26^^xsd:date
http://www.oeg-upm.net/
URIs in RDF
! URI component parts (RFC3986)
-! http://www.oeg-upm.net:8080/Info/People?position=current#Raul
Scheme Authority Path Query Fragment
! RDF URIs:
-! Are URI references: URI + Fragment -! Can contain Unicode characters -! Identify resources and values (e.g., mailto:rgarcia@fi.upm.es)
http://www.oeg-upm.net/Properties#hasFullName
http://www.oeg-upm.net/People#Raul
http://www.oeg-upm.net/Properties#hasBirthDate 1975-12-26^^xsd:date http://www.oeg-upm.net/Properties#isMemberOf http://www.oeg-upm.net/Properties#hasWebPage
http://www.oeg-upm.net/Organization#OEG
http://www.oeg-upm.net/
Namespaces in RDF
! Namespaces defined using XML qualified names ! URIs under a namespace are called vocabularies
Prefix people organization properties rdf rdfs xsd URI http://www.oeg-upm.net/People# http://www.oeg-upm.net/Organization# http://www.oeg-upm.net/Properties# http://www.w3.org/1999/02/22-rdf-syntax-ns# http://www.w3.org/2000/01/rdf-schema# http://www.w3.org/2001/XMLSchema#
properties:hasFullName
people:Raul
properties:hasBirthDate
properties:isMemberOf
1975-12-26^^xsd:date
organization:OEG
Ral Garca Castro et al.
properties:hasWebPage
http://www.oeg-upm.net/
10
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
Classifying resources
! The rdf:type property is used to classify resources in categories/classes
category:Person
rdf:type rdf:type rdf:type
category:Animal
rdf:type
Classes
people:Raul
people:Oscar
people:Missy
people:Fantasma
Instances
properties:hasFullName
rdf:type
12
people:Raul
properties:firstName properties:lastName
Ral
Garca Castro
13
RDF Containers
! Describe groups of things
-! A book was created by several authors -! A lesson is taught by several persons -! etc.
people:Raul
rdf:_1 rdf:_2
rdf:Seq
rgarcia@fi.upm.es
Ral Garca Castro et al.
r.garcia@upm.es
14
RDF Collections
! Groups of things represented as a list structure
-! A container with limits
university:Course1
rdf:next rdf:first
people:Raul
people:Oscar
rdf:next
rdf:nil
15
RDF Reification
! RDF statements about other RDF statements
-! Ral believes that Oscars birthdate is on Feb 2nd, 1976 and that his e-mail address is ocorcho@fi.upm.es
people:Raul
properties:hasEmailAddress
properties:hasBirthDate
ocorcho@fi.upm.es
1976-02-02^^xsd:date
! RDF Reification
-! Allows expressing beliefs (and other modalities) -! Allows expressing trust models, digital signatures, etc. -! Allows expressing metadata about metadata
16
! Scarcely used
product:hasWeight
product:Item1
rdf:value units:hasWeightUnit
2.4^^xsd:float
units:Kilogram
17
Individuals
rdf:first rdf:rest
rdf:nil
rdf:value
18
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
RDF Serialisations
! Normative
-! RDF/XML (www.w3.org/TR/rdf-syntax-grammar/)
20
10
people:Oscar
people:hasName
people:Asun
people:hasHomePage
people:Raul
http://www.oeg-upm.net/
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:person="http://www.ontologies.org/ontologies/people#" xmlns="http://www.oeg-upm.net/ontologies/people#" xml:base="http://www.oeg-upm.net/ontologies/people"> <rdf:Property rdf:about="http://www.ontologies.org/ontologies/people#hasHomePage"/> <rdf:Property rdf:about="http://www.ontologies.org/ontologies/people#hasColleague"/> <rdf:Property rdf:about="http://www.ontologies.org/ontologies/people#hasName"/> <rdf:Description rdf:about="#Raul"/> <rdf:Description rdf:about="#Asun"> <person:hasColleague rdf:resource="#Raul"/> <person:hasHomePage>http://www.fi.upm.es</person:hasHomePage> </rdf:Description> <rdf:Description rdf:about="#Oscar"> <person:hasColleague rdf:resource="#Asun"/> <person:hasName>Oscar Corcho Garca</person:hasName> </rdf:Description> </rdf:RDF>
21
Blank Nodes
Enclosed in <> <URI> or @prefix prefix <http://....> prefix:name or :name [] for a Blank Node used once
Literals
Datatyped Literals
22
11
! RDF collections
23
people:Oscar
people:hasName
people:Asun
people:hasHomePage
people:Raul
http://www.oeg-upm.net/
@base <http://www.oeg-upm.net/ontologies/people/ > @prefix vocab: <http://www.ontologies.org/ontologies/people#> :Asun vocab:hasColleague :Raul ; vocab:hasHomePage http://www.fi.upm.es/. :Oscar vocab:hasColleague :Asun ; vocab:hasName scar Corcho Garca.
24
12
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
Exercise
! Objective ! Get used to the different syntaxes of RDF ! Tasks ! Take the text of an RDF file and create its corresponding graph ! Take an RDF graph and create its corresponding RDF/XML and Turtle files
26
13
! Open the file StickyNote_PureRDF.rdf ! Create the corresponding graph from it ! Compare your graph with those of your colleagues
27
sn:eventDate
2006-05-15
sn:event3
sn:involves
sn:PinarAlper
28
14
Measurement8401
29
2010-06-12T12:00:12
29
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
15
RDF Schema
! Extends RDF ! Allows describing classes of resources and their properties ! Adds constraints on models
rdfs:member rdfs:seeAlso rdfs:isDefinedBy rdf:value rdf:first rdfs:label rdfs:comment
rdfs:Resource
rdf:subject rdf:predicate rdf:object rdfs:subPropertyOf
rdf:type rdfs:subclassOf
rdf:rest
rdf:List
rdfs:Container
rdf:Statement
rdf:Property
rdfs:Class
rdfs:domain rdfs:range
rdfs:Literal
rdf:Bag rdf:nil
rdf:Seq
rdf:Alt
rdfs:ContainerMembershipProperty rdfs:member
rdfs:Datatype
rdf:XMLLiteral
rdf:_1
Ral Garca Castro et al.
rdf:_2
rdf:_3
31
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
16
Describing classes
RDF(S)
rdfs:Class
rdf:type
Person
person:Person
rdfs:subClassOf
person:Professor
rdfs:subClassOf
person:FullProfessor
person:AssociateProfessor
rdfs:subClassOf
person:InterimAssociateProfessor
Data
person:hasColleague
person:hasColleague
data:Oscar
person:hasName
data:Asun
person:hasHomePage
data:Raul
http://www.oeg-upm.net/
33
Describing individuals
RDF(S)
rdfs:Class
rdf:type
Person
person:Person
rdfs:subClassOf
person:Professor
rdfs:subClassOf
person:FullProfessor
person:AssociateProfessor
rdfs:subClassOf
person:InterimAssociateProfessor
rdf:type rdf:type person:hasColleague person:hasColleague rdf:type
Data
data:Oscar
person:hasName
data:Asun
person:hasHomePage
data:Raul
http://www.oeg-upm.net/
34
17
Describing properties
RDF(S)
rdf:Property
rdf:type
rdfs:Class
rdf:type
Person
rdfs:range
rdfs:domain
rdfs:Literal
person:hasName
rdfs:domain rdfs:range
person:Person
rdfs:subClassOf
person:hasColleague
rdfs:domain
person:Professor
rdfs:subClassOf
person:hasHomePage
person:FullProfessor
person:AssociateProfessor
rdfs:subClassOf
person:InterimAssociateProfessor
rdf:type rdf:type person:hasColleague person:hasColleague rdf:type
Data
data:Oscar
person:hasName
data:Asun
person:hasHomePage
data:Raul
http://www.oeg-upm.net/
35
Annotating resources
rdfs:label
Ral Garca
rdfs:label
Ral
data:Raul
rdfs:comment
rdfs:seeAlso
http://delicias.dia.fi.upm.es/~rgarcia/
rdfs:isDefinedBy
http://delicias.dia.fi.upm.es/~rgarcia/foaf.rdf
36
18
Properties rdfs:subClassOf
Individuals
rdfs:member
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
19
39
40
20
a is equivalent to rdf:type
42
21
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
Exercise
!Objective ! Get used to the different syntaxes of RDF(S) !Tasks ! Take the text of an RDF(S) file and create its corresponding graph ! Take an RDF(S) graph and create its corresponding RDF/XML and N3 files
44
22
! Open the files StickyNote.rdf and StickyNote.rdfs ! Create the corresponding graph from them ! Compare your graph with those of your colleagues
45
Local_event
Personal_event
rdf:type
involves involves
CaroleGoble rdf:type
PinarAlper rdf:type
rdf:type Researcher
Professor
46
23
eventDate
xsd:date
rdfs:subClassOf rdfs:subClassOf
Personal_event Local_event
involves
Professor
rdfs:subClassOf
Researcher
47
29
2010-06-12T12:00:12
48
24
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
RDF(S) limitations
! RDFS too weak to describe resources in sufficient detail
-! No localised range and domain constraints
! Cant say that the range of hasChild is person when applied to persons and elephant when applied to elephants
-! No existence/cardinality constraints
! Cant say that all instances of person have a mother that is also a person, or that persons have exactly 2 parents
-! No boolean operators
! Cant say or, not, etc.
50
25
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
Exercise
!Objective ! Understand the features of RDF(S) for implementing ontologies, including its limitations !Tasks ! From a domain description, create the RDF(S) graph ! First only include the vocabulary from the domain ! Then include references to the RDF and RDFS vocabularies
Ral Garca Castro et al. 52
26
SpatialThing hasInhabitantNumber rdfs:Literal hasStreet hasNumber Location isPlacedIn Locality rdfs:Literal inProvince PostalAddress hasAddress LocationOfInterest Village Town City
TouristicLocation
Establishment
Palace
Church
Chapel
Cathedral
Hotel
Hostel
GuestHouse
54
27
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
56
28
data:Oscar
person:hasName
data:Asun
person:hasHomePage
data:Raul
http://www.oeg-upm.net/
! Query: Tell me who are the persons who have Asun as a colleague
person:hasColleague
data:Raul
-! Result: data:Asun
57
data:Oscar
data:Asun
-! Result: person:hasColleague
data:Oscar
person:hasHomePage
-! Result: http://www.oeg-upm.net/
Ral Garca Castro et al. 58
29
59
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
30
61
62
31
Index
! Overview ! RDF
-! -! -! -! -! -! -! -! -! -! Introduction RDF components Serializing RDF Hands-on Introduction Main RDF-S components Serializing RDF-S Hands-on RDF(S) Limitations Hands-on
! RDF Schema
! Reasoning
-! Reasoning with RDF -! Reasoning with RDF-S
! Python:
64
32
Jena
! Java framework for building Semantic Web applications ! Open source software from HP Labs ! The Jena framework includes:
-! -! -! -! -! -! A RDF API An OWL API Reading and writing RDF in RDF/XML, N3 and N-Triples In-memory and persistent storage A rule based inference engine SPARQL query engine
65
Sesame
! A framework for storage, querying and inferencing of RDF and RDF Schema ! A Java Library for handling RDF ! A Database Server for (remote) access to repositories of RDF data ! Highly expressive query and transformation languages
-! SeRQL, SPARQL
! Various backends
-! Native Store -! RDBMS (MySQL, Oracle 10, DB2, PostgreSQL) -! Main memory
! Reasoning support
-! RDF Schema reasoner -! OWL DLP (OWLIM) -! Domain reasoning (custom rule engine)
Ral Garca Castro et al. 66
33
John Smith
vcard:Given
vcard:Family
John
Smith
// some definitions String personURI = "http://somewhere/JohnSmith"; String givenName = "John"; String familyName = "Smith"; String fullName = givenName + " " + familyName; // create an empty Model Model model = ModelFactory.createDefaultModel(); // create the resource // and add the properties cascading style Resource johnSmith = model.createResource(personURI) .addProperty(VCARD.FN, fullName) .addProperty(VCARD.N, model.createResource() .addProperty(VCARD.Given, givenName) .addProperty(VCARD.Family, familyName));
Ral Garca Castro et al.
http://jena.sourceforge.net/tutorial/RDF_API/
67
// read the RDF/XML file model.read(in, ""); // write it to standard out model.write(System.out);
>
xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:vcard='http://www.w3.org/2001/vcard-rdf/3.0#' <rdf:Description rdf:nodeID="A0"> <vcard:Family>Smith</vcard:Family> <vcard:Given>John</vcard:Given> </rdf:Description> <rdf:Description rdf:about='http://somewhere/JohnSmith/'> <vcard:FN>John Smith</vcard:FN> <vcard:N rdf:nodeID="A0"/> </rdf:Description> ... </rdf:RDF> http://jena.sourceforge.net/tutorial/RDF_API/
68
34
! IsaViz ! Morla
69
Main References
! Brickley D, Guha RV (2004) RDF Vocabulary Description Language 1.0: RDF Schema. W3C Recommendation http://www.w3.org/TR/PR-rdf-schema/ ! Lassila O, Swick R (1999) Resource Description Framework (RDF) Model and Syntax Specification. W3C Recommendation http://www.w3.org/TR/REC-rdf-syntax/ ! RDF validator: http://www.w3.org/RDF/Validator/ ! RDF resources: http://planetrdf.com/guide/
Ral Garca Castro et al. 70
35
36