Presentation is loading. Please wait.

Presentation is loading. Please wait.

Speaker: Daniel Vila Suero RDF and RDF Schema Raúl García-Castro, Óscar Corcho, Daniel Vila-Suero Ontology Engineering Group Universidad.

Similar presentations


Presentation on theme: "Speaker: Daniel Vila Suero RDF and RDF Schema Raúl García-Castro, Óscar Corcho, Daniel Vila-Suero Ontology Engineering Group Universidad."— Presentation transcript:

1 Speaker: Daniel Vila Suero RDF and RDF Schema Raúl García-Castro, Óscar Corcho, Daniel Vila-Suero Ontology Engineering Group Universidad Politécnica de Madrid, Spain

2 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 2

3 © Raúl García Castro et al. RDF and RDF Schema RDF: Resource Description Framework Goal -To describe the semantics of information in a machine- processable way W3C recommendations -Model -Syntax -Semantics 3 DatabaseXMLRDF(S) Schema Data RDF Schema RDF

4 © Raúl García Castro et al. RDF(S) in the Semantic Web 4

5 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 5

6 © Raúl García Castro et al. Also known as “triples” -[Subject, Predicate, Object] “Raúl is a member of the Ontology Engineering Group” -[Raúl, is member of, Ontology Engineering Group] “Raúl’s full name is Raúl García Castro” -[Raúl, has full name, Raúl García Castro] “Raúl was born on 26 December 1975” -[Raúl, was born, 26 December 1975] “The Ontology Engineering Group web page is -[Ontology Engineering Group, has web page, RDF statements 6 is member of Raúl Ontology Engineering Group Raúl Raúl García Castro has full name Raúl 26 December 1975 has birth date has web page Ontology Engineering Group Raúl Ontology Engineering Group

7 © Raúl García Castro et al. RDF graphs RDF graphs are sets of triples 7 is member of Raúl Ontology Engineering Group Raúl García Castro has full name 26 December 1975 has birth date has web page

8 © Raúl García Castro et al. RDF literals Triple objects can be literals (character strings) -Subject and predicates are always resources Literals can be typed -Usually using XML Schema datatypes -RDF provides the rdf:XMLLiteral datatype 8 is member of Raúl Ontology Engineering Group “Raúl García Castro” has full name “ ”^^xsd:date has birth date has web page

9 © Raúl García Castro et al. URIs in RDF URI component parts (RFC3986) -http://www.oeg-upm.net:8080/Info/People?position=current#Raul URIs in RDF: -Are URI references: URI + Fragment -Can contain Unicode characters -Identify resources and values (e.g., 9 SchemeAuthority Path QueryFragment “Raúl García Castro” “ ”^^xsd:date

10 © Raúl García Castro et al. Namespaces in RDF Namespaces defined using XML qualified names URIs under a namespace are called vocabularies 10 PrefixURI peoplehttp://www.oeg-upm.net/People# organizationhttp://www.oeg-upm.net/Organization# propertieshttp://www.oeg-upm.net/Properties# rdfhttp://www.w3.org/1999/02/22-rdf-syntax-ns# rdfshttp://www.w3.org/2000/01/rdf-schema# xsdhttp://www.w3.org/2001/XMLSchema# properties:isMemberOf people:Raul organization:OEG “Raúl García Castro” properties:hasFullName “ ”^^xsd:date properties:hasBirthDate properties:hasWebPage

11 © Raúl García Castro et al. RDF is a URI-based vocabulary RDF resources are identified using URIs -(blank nodes are an exception) Advantages: -Flexibility -Self-reference -Reification Disadvantages: -Complexity -Validation -Tool support 11 people:Raul “Raúl García Castro” properties:hasFullName meta:Triple1 meta:subject meta:predicate meta:object meta:created “ ”^^xsd:date meta:creationDate meta:equivalentTo

12 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 12

13 © Raúl García Castro et al. Classifying resources The rdf:type property is used to classify resources in categories/classes The rdf:Property class is the class of all properties 13 people:Raul category:Person rdf:type people:Oscar rdf:type people:Missy category:Animal rdf:type people:Fantasma rdf:type Classes Instances properties:hasFullName rdf:Property rdf:type

14 © Raúl García Castro et al. Blank nodes: structured property values Most real-world data involves structures that are more complicated than sets of RDF triple statements 14 people:Raul properties:hasFullName “Raúl” properties:firstName “García Castro” properties:lastName This intermediate URI does not need to have a name

15 © Raúl García Castro et al. RDF Containers Describe groups of things -A book was created by several authors -A lesson is taught by several persons -etc. RDF provides a container vocabulary -rdf:Bag. Group of resources or literals, including duplicates, where order is not significant -rdf:Seq. Group of resources or literals, including duplicates, where order is significant -rdf:Alt. Group of resources or literals that are alternatives (typically for a single value of a property) 15 people:Raul properties:has Address rdf:_1 rdf:_2 rdf:Seq rdf:type

16 © Raúl García Castro et al. RDF Collections Groups of things represented as a list structure -“A container with limits” Constructed using rdf:List, rdf:first, rdf:rest, and rdf:nil 16 university:Course1 university:hasTeacher rdf:next people:Raul rdf:first rdf:nil rdf:next people:Oscar rdf:first rdf:List rdf:type

17 © Raúl García Castro et al. RDF Reification RDF statements about other RDF statements -“Raúl believes that Oscar’s birthdate is on Feb 2nd, 1976 and that his address is Expressed using rdf:Statement, rdf:subject, rdf:predicate, and rdf:object, or using rdf:ID RDF Reification -Allows expressing beliefs (and other modalities) -Allows expressing trust models, digital signatures, etc. -Allows expressing metadata about metadata 17 people:Raul people:Oscar modal:believes properties:has Address “ ”^^xsd:date properties:hasBirthDate

18 © Raúl García Castro et al. Main value of a structured value Sometimes one of the values of a structured value is the main one -The weight of an item is 2.4 kilograms -The main value is 2.4, which is expressed with rdf:value Scarcely used 18 product:Item1 product:hasWeight “2.4”^^xsd:float rdf:value units:Kilogram units:hasWeightUnit

19 © Raúl García Castro et al. RDF vocabulary summary ClassesPropertiesIndividuals Classification rdf:Propertyrdf:type Containers rdf:Bagrdf:_1, rdf:_2, rdf:_3… rdf:Seq rdf:Alt Collections rdf:Listrdf:firstrdf:nil rdf:rest Reification rdf:Statementrdf:subject rdf:predicate rdf:object Values rdf:XMLLiteralrdf:value 19

20 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 20

21 © Raúl García Castro et al. RDF Serialisations Normative -RDF/XML (http://www.w3.org/TR/rdf-syntax-grammar/) -RDFa (http://www.w3.org/TR/rdfa-core/) Candidate Recommendation (19 February 2013) -Turtle (http://www.w3.org/TR/turtle/) Alternative (for human consumption) -Notation 3 (N3) (http://www.w3.org/DesignIssues/Notation3.html) -N-Triples (http://www.w3.org/TR/rdf-testcases/#ntriples) -TriX (http://www.w3.org/2004/03/trix/) -… Important: the RDF serializations allow different syntactic variants. -E.g., the order of RDF statements has no meaning 21

22 © Raúl García Castro et al. RDF/XML: XML Declaration and Document XML declaration ( ) -Optional but recommended Document element ( … ) -Optionally includes attributes for namespace definition: xml:base. Base URI other than the base URI of the document or external entity (for relative URIs) xmlns. Default namespace xmlns:xxxx. Namespace prefix 22

23 © Raúl García Castro et al. RDF/XML: RDF resources … … 23 people:Raul people:Asun people:Oscar people:hasColleague people:hasHomePage people:hasColleague people:hasName Relative to the base URI Using the rdf namespace

24 © Raúl García Castro et al. RDF/XML: RDF properties 24 people:hasColleague people:Raul people:Asun people:hasHomePage people:hasColleague people:Oscar “Óscar Corcho García” people:hasName... Oscar Corcho García... Grouping multiple properties Empty property element

25 © Raúl García Castro et al. RDF/XML: Property and language attributes 25 people:hasColleague people:Raul people:Asun people:hasHomePage people:hasColleague people:Oscar “Óscar Corcho García” people:hasName... Professor... Language attribute Property attribute

26 © Raúl García Castro et al. RDF/XML: Typed and XML literals Raul Typed literal XML Literal

27 © Raúl García Castro et al. RDF/XML: Blank nodes Blank node identified Blank node omitted people:hasColleague

28 © Raúl García Castro et al. RDF/XML: URI Abbreviations and Typed Nodes 28 { "@context": "http://schema.org", "@type": "ImageObject", "contentUrl": "http://images.slideplayer.com/3345354/11/slides/slide_27.jpg", "name": "© Raúl García Castro et al.", "description": "RDF/XML: URI Abbreviations and Typed Nodes 28

29 © Raúl García Castro et al. RDF/XML: Complete example Oscar Corcho García 29 people:hasColleague people:Raul people:Asun people:hasHomePage people:hasColleague people:Oscar “Óscar Corcho García” people:hasName

30 © Raúl García Castro et al. RDF serializations. Turtle Terse RDF Triple Language -W3C Working Draft 09 August 2011 Extends N-Triples Adding parts of Notation 3 Subset of the SPARQL grammar A Turtle triple: -subject predicate object. A Turtle comment: -# This is a comment 30

31 © Raúl García Castro et al. Turtle: IRIs Enclosed in ' ' Absolute Relative to the current base IRI <> :. foo:bar foo: :. :bar : foo:bar. Definition of base 31

32 © Raúl García Castro et al. Turtle: Literals Without linebreaks "simple literal" With linebreaks """this is a long literal""" Can have either language suffix or datatype but not both With language suffix "La With datatype IRI "mylexicaldata"^^ "10"^^xsd:decimal Literals without language tag or datatype are literals with the type xsd:string "10"  "10"^^xsd:string 32

33 © Raúl García Castro et al. Turtle: Blank nodes Using _:label :a :b _:n1. Using [] :a :b [ :c :d ]. which is the same as: :a :b _:x. _:x :c :d. 33

34 © Raúl García Castro et al. Turtle: Abbreviations a is equivalent to doc:. a doc:Document. Decimal integers -5  "-5"^^xsd:integer Decimal floating point double/fixed precision numbers 1.3e2  "1.3e2"^^xsd:double Decimal floating point arbitrary precision numbers 0.0  "0.0"^^xsd:decimal Boolean true  "true"^^xsd:boolean 34

35 © Raúl García Castro et al. Turtle: Abbreviating groups of triples Triples that only differ in the object :subject :predicate :object1, :object2. which is the same as :subject :predicate :object1. :subject :predicate :object2. Triples that vary only in predicate and object :subject :predicate1 :obj1 ; :predicate2 :obj2. which is the same as :subject :predicate1 :obj1. :subject :predicate2 :obj2. 35

36 © Raúl García Castro et al. Turtle: Abbreviating RDF Collections Sequence of terms enclosed in ( ) and separated with whitespace Provides a blank node at the start of RDF Collection which may be used in further :. :subject :predicate ( :a :b :c ). :subject :predicate2 (). 36

37 © Raúl García Castro et al. Turtle: people:. :Asun people:hasColleague :Raul ; people:hasHomePage. :Oscar people:hasColleague :Asun ; people:hasName "Óscar Corcho García". 37 people:hasColleague people:Raul people:Asun people:hasHomePage people:hasColleague people:Oscar “Óscar Corcho García” people:hasName

38 © Raúl García Castro et al. RDF Serialisations. RDFa 38 people:hasColleague people:Raul people:Asun people:hasHomePage people:hasColleague people:Oscar “Óscar Corcho García” people:hasName Asunción Gómez Pérez Has home page. Is friend of Raúl. Óscar Corcho García Is friend of Asun.

39 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 39

40 © Raúl García Castro et al. RDF Schema Extends RDF Allows describing classes of resources and their properties Adds constraints on models 40 rdfs:Resource rdfs:Container rdf:Listrdf:Property rdfs:Class rdf:Statement rdfs:Datatype rdfs:Literal rdf:XMLLiteralrdf:Bagrdf:Seqrdf:Alt rdf:nil rdfs:ContainerMembershipProperty rdf:_1rdf:_2rdf:_3 rdfs:member rdfs:seeAlso rdfs:isDefinedBy rdf:value rdfs:label rdfs:comment rdf:subject rdf:predicate rdf:object rdf:type rdfs:subclassOf rdfs:domain rdfs:range rdfs:subPropertyOf rdf:first rdf:rest rdfs:member

41 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 41

42 © Raúl García Castro et al. Describing classes 42 person:hasColleague data:Raul data:Asun person:hasHomePage person:hasColleague data:Oscar “Óscar Corcho García” person:hasName person:AssociateProfessor person:Professor person:Person person:InterimAssociateProfessor person:FullProfessor rdfs:subClassOf rdfs:Class RDF(S) Person Data rdf:type

43 © Raúl García Castro et al. Describing individuals 43 person:hasColleague data:Raul data:Asun person:hasHomePage person:hasColleague data:Oscar “Óscar Corcho García” person:hasName person:AssociateProfessor person:Professor person:Person person:InterimAssociateProfessor person:FullProfessor rdf:type rdfs:subClassOf rdfs:Class RDF(S) Person Data rdf:type

44 © Raúl García Castro et al. Describing properties 44 person:hasColleague data:Raul data:Asun person:hasHomePage person:hasColleague data:Oscar “Óscar Corcho García” person:hasName person:AssociateProfessor person:Professor person:Person person:InterimAssociateProfessor person:FullProfessor person:hasName rdfs:Literal rdfs:domain rdfs:range person:hasHomePage rdfs:domain rdf:type rdfs:subClassOf rdf:Propertyrdfs:Class RDF(S) Person Data rdf:type person:hasColleague rdfs:domain rdfs:range

45 © Raúl García Castro et al. Annotating resources 45 data:Raul rdfs:label “Raúl” rdfs:comment “Resource for Raúl García Castro” rdfs:seeAlso rdfs:isDefinedBy rdfs:label “Raúl García”

46 © Raúl García Castro et al. RDF-S vocabulary summary ClassesPropertiesIndividuals Classification rdfs:Resourcerdfs:subClassOf rdfs:Class Properties rdfs:domain rdfs:range rdfs:subPropertyOf Datatypes rdfs:Literal rdfs:Datatype Containers rdfs:Containerrdfs:member rdfs:ContainerMembershipProperty Annotation rdfs:label rdfs:comment rdfs:seeAlso rdfs:isDefinedBy 46

47 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 47

48 © Raúl García Castro et al. RDF/XML syntax (1/2) ]>... 48

49 © Raúl García Castro et al. RDF/XML syntax (2/2)... Oscar Corcho García 49

50 © Raúl García Castro et al. Turtle person:. :hasColleague a rdfs:Property. rdfs:domain :Person. rdfs:range :Person ; :hasHomePage a rdfs:Property. rdfs:domain :FullProfessor. :hasName a rdfs:Property. rdfs:domain :Person ; rdfs:range rdfs:Literal. … a is equivalent to rdf:type 50

51 © Raúl García Castro et al. Turtle syntax (2/2) … :Person a rdfs:Class. :Professor a rdfs:Class ; rdfs:subClassOf :Person. :FullProfessor a rdfs:Class ; rdfs:subClassOf :Professor. :AssociateProfessor a rdfs:Class ; rdfs:subClassOf :Professor. :InterimAssociateProfessor a rdfs:Class ; rdfs:subClassOf :AssociateProfessor. :Asun a :FullProfessor ; :hasHomePage "http://www.fi.upm.es" ; :hasColleague :Raul. :Oscar a :AssociateProfessor ; :hasName "Oscar Corcho García" ; :hasColleague :Asun. :Raul a :InterimAssociateProfessor. a is equivalent to rdf:type 51

52 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 52

53 © Raúl García Castro et al. RDF(S) limitations RDFS too weak to describe resources in sufficient detail -No localised range and domain constraints Can’t say that the range of hasChild is person when applied to persons and elephant when applied to elephants -No existence/cardinality constraints Can’t say that all instances of person have a mother that is also a person, or that persons have exactly 2 parents -No boolean operators Can’t say or, not, etc. -No transitive, inverse or symmetrical properties Can’t say that isPartOf is a transitive property, that hasPart is the inverse of isPartOf or that touches is symmetrical Difficult to provide reasoning support -No “native” reasoners for non-standard semantics -May be possible to reason via FOL axiomatisation 53

54 © Raúl García Castro et al. Index Overview RDF -Introduction -RDF components -Serializing RDF RDF Schema -Introduction -Main RDF-S components -Serializing RDF-S -RDF(S) Limitations Reasoning -Reasoning with RDF -Reasoning with RDF-S RDF(S) management APIs 54

55 © Raúl García Castro et al. Sample RDF APIs Usually related to a RDF repository RDF libraries for different languages: -Java, Python, C, C++, C#,.Net, Javascript, Tcl/Tk, PHP, Lisp, Obj-C, Prolog, Perl, Ruby, Haskell -List in Multilanguage: -Redland RDF Application Framework (C, Perl, PHP, Python and Ruby): Java: -Jena: -Sesame: PHP: -RAP - RDF API for PHP: Python: -RDFLib: -Pyrple: 55

56 © Raúl García Castro et al. Jena Java framework for building Semantic Web applications Open source Apache project -Created by 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 56

57 © Raúl García Castro et al. Sesame A framework for storage, querying and inferencing of RDF and RDF Schema -Java Library for handling RDF -Database Server for (remote) access to repositories of RDF data Highly expressive query and transformation languages -SeRQL, SPARQL Various back-ends -Native Store -RDBMS (MySQL, Oracle 10, DB2, PostgreSQL) -Main memory Reasoning support -RDF Schema reasoner -OWL DLP (OWLIM) -Domain reasoning (custom rule engine) 57

58 © Raúl García Castro et al. Jena example. Graph creation John Smith SmithJohn vcard:Givenvcard:Family vcard:FN vcard:N // 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)); 58

59 © Raúl García Castro et al. Jena example. Read and write // create an empty model Model model = ModelFactory.createDefaultModel(); // use the FileManager to find the input file InputStream in = FileManager.get().open( inputFileName ); if (in == null) { throw new IllegalArgumentException("File not found"); } // read the RDF/XML file model.read(in, ""); // write it to standard out model.write(System.out); Smith John John Smith

60 © Raúl García Castro et al. Some RDF editors Standalone Ganesha (http://event-horizon.kicks-ass.net/uni/ganesha/) IsaViz (http://www.w3.org/2001/11/IsaViz/) Morla (http://www.morlardf.net/) RDFAuthor (http://rdfweb.org/people/damian/RDFAuthor/) rdfEditor (http://www.dotnetrdf.org/content.asp?pageID=rdfEditor) RDF Editor in Java (http://sourceforge.net/projects/rdfeditor/) RdfGravity (http://semweb.salzburgresearch.at/apps/rdf-gravity/index.html) Rej (http://infinitesque.net/projects/Legere/components/Rej/) Rhodonite (http://rhodonite.angelite.nl/) Command line RDFe (http://infomesh.net/pyrple/rdfe/) Online RDF Editor (http://tesis-e.googlecode.com/svn/trunk/rdf-editor/index.html) Turtled (http://turtled.net/) Ontology engineering environments Protégé (http://protege.stanford.edu/) Altova SemanticWorks (http://www.altova.com/semanticworks/rdf-editor.html) TopBraid Composer (http://www.topquadrant.com/products/TB_Composer.html) 60

61 © Raúl García Castro et al. Main References Brickley D, Guha RV (2004) RDF Vocabulary Description Language 1.0: RDF Schema. W3C Recommendation 10 February Beckett D (2004) RDF/XML Syntax Specification (Revised) W3C Recommendation 10 February Beckett D, Berners-Lee T, Prud'hommeaux E, Carothers G (Turtle: Terse RDF Triple Language. W3C Candidate Recommendation 19 February 2013) Hayes P (2004) RDF Semantics W3C Recommendation 10 February RDF validators: RDF resources: 61

62 Speaker: Daniel Vila Suero Thank you for your attention!


Download ppt "Speaker: Daniel Vila Suero RDF and RDF Schema Raúl García-Castro, Óscar Corcho, Daniel Vila-Suero Ontology Engineering Group Universidad."

Similar presentations


Ads by Google