Introduction to RDF

1,565 views
1,572 views

Published on

A simple introduction to RDF

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,565
On SlideShare
0
From Embeds
0
Number of Embeds
738
Actions
Shares
0
Downloads
33
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Introduction to RDF

  1. 1. RDFPedro SzekelyUniversity of Southern California/ISI
  2. 2. Semantic Web Layer Cakeslide by Pedro Szekely
  3. 3. Unicodeslide by Pedro Szekely
  4. 4. Why Unicode?http://site.com/Μία_Σελίδαhttp://site.com/Македонски.htmlhttp://www.中国政府.政务.cnslide by Pedro Szekely
  5. 5. Unicode is a computing industry standard forthe consistent encoding, representation andhandling of text expressed in most of theworlds writing systems.… the latest version of Unicode consists of arepertoire of more than 110,000 characterscovering 100 scriptsUnicodeWikipediaslide by Pedro Szekely
  6. 6. URIslide by Pedro Szekely
  7. 7. URL: Uniform Resource LocatorA reference to an Internet resourceWeb ServerURLDocument(Resource)slide by Pedro Szekely
  8. 8. URL vs URIURIURL URNnameslocatorslike a persons namelike persons street addressitems identitymethod for finding itslide by Pedro Szekely
  9. 9. Can USC Have a URI?slide by Pedro Szekely
  10. 10. Can USC Have a URI?http://dbpedia.org/page/University_of_Southern_Californiaslide by Pedro Szekely
  11. 11. Things can have URIs
  12. 12. Can the Pythagoras TheoremHave a URI?slide by Pedro Szekely
  13. 13. Can the Pythagoras TheoremHave a URI?http://www.freebase.com/view/en/pythagorean_theoremslide by Pedro Szekely
  14. 14. Ideas can have URIs
  15. 15. My Dog: Can He Have a URI?slide by Pedro Szekely
  16. 16. My Dog: Can He Have a URI?http://szekelys.com/diegoslide by Pedro Szekely
  17. 17. It does not have to be “important” to have a URI
  18. 18. Namespacesslide by Pedro Szekely
  19. 19. Are These the Same?<http://amazon.com/store/Bookstore><http://amazon.com/store/Book><http://amazon.com/store/Author>John Doe</http://amazon.com/store/Author><http://amazon.com/store/Title>Introduction to XML</http://amazon.com/store/Title><http://amazon.com/store/Publisher>XYZ</http://amazon.com/store/Publisher></http://amazon.com/store/Book></http://amazon.com/store/Bookstore><http://barnesandnoble.com/store/Bookstore><http://barnesandnoble.com/store/Book><http://barnesandnoble.com/store/Author>John Doe</http://barnesandnoble.com/store/Author><http://barnesandnoble.com/store/Title>Introduction to XML</http://barnesandnoble.com/store/Title><http://barnesandnoble.com/store/Publisher>XYZ</http://barnesandnoble.com/store/Publisher></http://barnesandnoble.com/store/Book></http://barnesandnoble.com/store/Bookstore><Bookstore><Book><Author>John Doe</Author><Title>Introduction to XML</Title><Publisher>XYZ</Publisher></Book></Bookstore>slide by Pedro Szekely
  20. 20. NamespacesXML namespaces are used forproviding uniquely named elementsand attributes in an XML documentxmlns="http://amazon.com/store"Wikipediaslide by Pedro Szekely
  21. 21. Using a Namespace Declaration<http://amazon.com/store/Bookstore><http://amazon.com/store/Book><http://amazon.com/store/Author>John Doe</http://amazon.com/store/Author><http://amazon.com/store/Title>Introduction to XML</http://amazon.com/store/Title><http://amazon.com/store/Publisher>XYZ</http://amazon.com/store/Publisher></http://amazon.com/store/Book></http://amazon.com/store/Bookstore><Bookstore xmlns=“http://amazon.com/store”><Book><Author>John Doe</Author><http://amazon.com/store/Title>Introduction to XML</Title><http://amazon.com/store/Publisher>XYZ</Publisher></Book></Bookstore>=slide by Pedro Szekely
  22. 22. Default and Prefix Namespaces<http://amazon.com/store/Bookstore><http://amazon.com/store/Book><http://amazon.com/store/Author>John Doe</http://amazon.com/store/Author><http://amazon.com/store/Title>Introduction to XML</http://amazon.com/store/Title><http://amazon.com/store/Publisher>XYZ</http://amazon.com/store/Publisher></http://amazon.com/store/Book></http://amazon.com/store/Bookstore><Bookstore xmlns=“http://amazon.com/store”><Book><Author>John Doe</Author><Title>Introduction to XML</Title><Publisher>XYZ</Publisher></Book></Bookstore>=<am:Bookstore xmlns:am=“http://amazon.com/store”><am:Book><am:Author>John Doe</am:Author><am:Title>Introduction to XML</am:Title><am:Publisher>XYZ</am:Publisher></am:Book></am:Bookstore>=slide by Pedro Szekely
  23. 23. Default and Prefix Namespaces<am:Bookstorexmlns:am=“http://amazon.com/store”xmlns:bn=http://barnesandnoble.com/store><am:Book><am:Author>John Doe</am:Author><bn:Author>Jane Doe</bn:Author><am:Title>Introduction to XML</am:Title><am:Publisher>XYZ</am:Publisher></am:Book></am:Bookstore>If elements were defined within a global scope,it would be a problem tocombine elements from multiple documentsslide by Pedro Szekely
  24. 24. XMLslide by Pedro Szekely
  25. 25. eXtensible Markup Language<h2>Nonmonotonic Reasoning</h2><i>by <b>V. Marek</b> and <b>M. Truszczynski</b></i><br>Springer 1993<br>ISBN 0387976892<book><title>Nonmonotonic Reasoning</title><author>V. Marek</author><author>M. Truszczynski</author><publisher>Springer</publisher><year>1993</year><ISBN>0387976892</ISBN></book>HTML specifies how to display dataXML specifies dataextensibleset of tagsfixedset of tagsslide by Pedro Szekely
  26. 26. Merging Problem in XML<Bookstore xmlns=“http://amazon.com”><Book id=“1”><Author>John</Author><Title>Introduction to XML</Title><Publisher>ACM</Publisher></Book><Book id=“2”><Author>Susan</Author><Title>Advanced</Title><Publisher>Springer</Publisher></Book></Bookstore><Bookstore xmlns=“http://amazon.com”><Book id=“1”><Author>John</Author><Title>Introduction to XML</Title></Book><Book id=“2”><Author>Susan</Author><Title>Advanced</Title></Book></Bookstore><Bookstore xmlns=“http://amazon.com”><Book id=“2”><Publisher>Springer</Publisher></Book><Book id=“1”><Publisher>ACM</Publisher></Book></Bookstore>… is difficultDocument 1Document 2Merged Documentslide by Pedro Szekely
  27. 27. Does XML Represent Meaning?<course name=“CS101”><instructor> John </instructor><course><instructor name=“John”><teaches>CS 101</teaches><instructor>John is an instructor for CS101Opposite nesting, same information!based on slide from Jose Luis Ambite
  28. 28. Does XML Represent Meaning?<course name=“CS101”><instructor> John </instructor><course><instructor name=“John”><teaches>CS 101</teaches><instructor>John is an instructor for CS101hasInstructor inverseOf teachesC,I hasInstructor(C,I) teaches(I,C)range(hasInstructor) = PersonC,I hasInstructor(C,I) Peson(I)based on slide from Jose Luis Ambite
  29. 29. Meaning of Data in XML?…<Book><Author>John</Author><Title>Introduction to XML</Title><Publisher>ACM</Publisher><Country>USA</Country></Book>…What is the meaning of Country?… where the book is sold?… where it is published?… where the author lives?… ???slide by Pedro Szekely
  30. 30. XML SchemaThe purpose of a schema is todefine a class of XML documents, and so the term"instance document" is often used todescribe an XML documentthat conforms to a particular schemahttp://www.w3.org/TR/xmlschema-0/a syntax checkerslide by Pedro Szekely
  31. 31. Example<xsd:complexType name="USAddress" ><xsd:sequence><xsd:element name="name" type="xsd:string"/><xsd:element name="street" type="xsd:string"/><xsd:element name="city" type="xsd:string"/><xsd:element name="state" type="xsd:string"/><xsd:element name="zip" type="xsd:decimal"/></xsd:sequence><xsd:attribute name="country" type="xsd:NMTOKEN" fixed="US"/></xsd:complexType>Defining the USAddress Type… must have specific elements… in a specific order… filled with specific types of dataslide by Pedro Szekely
  32. 32. XML Schema Primitive TypesstringbooleandecimalfloatdoubledurationdateTimetimedategYearMonthgYeargMonthDaygDaygMonthhexBinarybase64BinaryanyURIQnameNOTATIONuseful in RDFslide by Pedro Szekely
  33. 33. ResourceDescriptionFrameworkslide by Pedro Szekely
  34. 34. The Resource Description Framework (RDF)is a language forrepresenting information about resourcesin the World Wide Webhttp://www.w3.org/TR/rdf-primer/slide by Pedro Szekely
  35. 35. Intended for representing metadata about Webresources, such as the title, author, and modification dateof a Web document… also be used to represent information aboutthings that can be identified on the Web,even when they cannot be directly retrieved on the Webexamples include information about items available from on-lineshopping facilities (e.g., prices and availability)Resource Description Frameworkslide by Pedro Szekely
  36. 36. Represent Resources Using URIshttp://szekelys.com/family#pedro“Pedro”http://xmlns.com/foaf/0.1/firstNameThat guy has first name “Pedro”slide by Pedro Szekely
  37. 37. Represent Information as Tripleshttp://szekelys.com/family#pedro “Pedro”http://xmlns.com/foaf/0.1/firstNameSubjectPredicateObjectThe resource being describedA property of the resourceThe value of the propertyslide by Pedro Szekely
  38. 38. Use Namespaceshttp://szekelys.com/family#pedro“Pedro”foaf:firstNamehttp://szekelys.com/family#pedro“Pedro”http://xmlns.com/foaf/0.1/firstNameslide by Pedro Szekely
  39. 39. RDF Graphshttp://szekelys.com/family#pedro“Pedro”foaf:firstNamefoaf:Personrdf:typehttp://isi.edu/~szekelyfoaf:homepageslide by Pedro Szekely
  40. 40. RDF Graphshttp://szekelys.com/family#pedro“Pedro”foaf:firstNamefoaf:Personrdf:typehttp://isi.edu/~szekelyfoaf:homepageslide by Pedro Szekely
  41. 41. Mix Vocabularieshttp://szekelys.com/family#pedro“Pedro”foaf:firstNamefoaf:Personrdf:typehttp://isi.edu/~szekelyfoaf:homepageschema:Personrdf:typehttp://szekelys.com/family#claudiaschema:spouseslide by Pedro Szekely
  42. 42. Why Use URIs? URIs look coolslide by Pedro Szekely
  43. 43. Why Use URIs? URIs look cool Precisely identify resources Avoid confusion among different “Jose Lopez” Precisely identify properties E.g., name of a company or name of a person Provide information about properties Look them up on the webslide by Pedro Szekely
  44. 44. XML vs RDF<course name=“CS101”><instructor> John </instructor><course><instructor name=“John”><teaches>CS 101</teaches><instructor>John is an instructor for CS101usc-people:prof-01“John”ex:isTeacherOfusc-course:cs-101ex:hasInstructorfoaf:name“CSC-101”ex:nameXMLRDFslide by Pedro Szekely
  45. 45. RDF SyntaxesLeverages XML toolsHard for humans to readXMLN3, TurtleN-TriplesTerse RDF Triple LanguageHuman readable formatWorks with software tooSubset of turtle, supports streamingStandard for large RDF dumpsRDFaAllows embedding RDF in HTML pagesslide by Pedro Szekely
  46. 46. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>Pedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  47. 47. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>It’s an XML documentPedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  48. 48. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>Here comes some RDFPedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  49. 49. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>Namespace declarationsPedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  50. 50. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>SubjectPedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  51. 51. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>PredicatePedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  52. 52. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>ValuePedro’s homepage is "http://isi.edu/~szekely"slide by Pedro Szekely
  53. 53. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>ValuePedro’s homepage is "http://isi.edu/~szekely"Subject Predicateslide by Pedro Szekely
  54. 54. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><rdf:Description rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></rdf:Description></rdf:RDF>http://szekelys.com/family#pedro foaf:firstName“Pedro”slide by Pedro Szekely
  55. 55. XML Syntax<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf="http://xmlns.com/foaf/0.1/"><foaf:Person rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></foaf:Person></rdf:RDF>http://szekelys.com/family#pedrofoaf:Personfoaf:firstName“Pedro”rdf:typeslide by Pedro Szekely
  56. 56. <?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:foaf=http://xmlns.com/foaf/0.1/><foaf:Person rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></foaf:Person></rdf:RDF><?xml version="1.0"?><rdf:RDF xmlns:rdf=…xmlns:foaf=…<foaf:Person rdf:about="http://szekelys.com/family#pedro"><foaf:firstName>Pedro</foaf:firstName></foaf:Person></rdf:RDF><?xml version="1.0"?><rdf:RDF xmlns:rdf=…xmlns:foaf=…<foaf:Person rdf:about="http://szekelys.com/family#pedro"><foaf:homepage rdf:resource="http://isi.edu/~szekely"/></foaf:Person></rdf:RDF>+slide by Pedro Szekely
  57. 57. RDF SyntaxesLeverages XML toolsHard for humans to readXMLN3, TurtleN-TriplesTerse RDF Triple LanguageHuman readable formatWorks with software tooSubset of turtle, supports streamingStandard for large RDF dumpsRDFaAllows embedding RDF in HTML pagesslide by Pedro Szekely
  58. 58. N3 and Turtle Syntaxes@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix foaf: <http://xmlns.com/foaf/0.1/> .<http://szekelys.com/family#pedro> foaf:firstName “Pedro” .<http://szekelys.com/family#pedro> rdf:type foafPerson .http://szekelys.com/family#pedrofoaf:Personfoaf:firstName“Pedro”rdf:typeEach triple ends with a dotslide by Pedro Szekely
  59. 59. More Complex Structures
  60. 60. “USC/ISI’s address is4676 Admiralty Way, Marina del Rey, CA 90292”usc:isischema:address“4676 Admiralty Way, Marina del Rey, CA 90292”.EnglishRDFIn what city is USC/ISI located?Find all universities in Californiaslide by Pedro Szekely
  61. 61. “USC/ISI’s address is4676 Admiralty Way, Marina del Rey, CA 90292”usc:isischema:address“4676 Admiralty Way, Marina del Rey, CA 90292”.EnglishRDFHow to represent nested structures?slide by Pedro Szekely
  62. 62. “USA”usc:isischema:addressCountryschema:address“CA”“Marina del Rey”“90292”“4676 Admiralty Way” schema:addressLocalityschema:postalCodeschema:addressRegionschema:streetAddressRepresents theaddress of USC/ISIslide by Pedro Szekely
  63. 63. “USC/ISI’s address is4676 Admiralty Way, Marina del Rey, CA 90292”usc:isi schema:address usc:isi-address .usc:isi-addressschema:addressCountry “USA” ;schema:addressRegion “CA”schema:addressLocality “Marina del Rey” ;schema:postalCode “90292” ;schema:streetAddress “4676 Admiralty Way” .EnglishRDFslide by Pedro Szekely
  64. 64. usc:isi schema:address usc:isi-address .usc:isi-addressschema:addressCountry “USA” ;schema:addressRegion “CA”schema:addressLocality “Marina del Rey” ;schema:postalCode “90292” ;schema:streetAddress “4676 Admiralty Way” .We minted a URI for USC/ISI’s address… but sometimes we don’t want to mint URIsslide by Pedro Szekely
  65. 65. usc:isi schema:address _:isi-address ._:isi-addressschema:addressCountry “USA” ;schema:addressRegion “CA”schema:addressLocality “Marina del Rey” ;schema:postalCode “90292” ;schema:streetAddress “4676 Admiralty Way” .Blank nodeBlank Nodesprefix is “_”… can be improved …slide by Pedro Szekely
  66. 66. What If I Don’t Know the URI?“Pedro Szekely lives in Los Angeles”English_:pedrofoaf:firstName “Pedro” ;foaf:lastName “Szekely” ;foaf:mbox “szekely1401@gmail.com” ;schema:addressLocality “Los Angeles” .RDFBlank node… is this useful? … maybeslide by Pedro Szekely
  67. 67. Typed Literalsgn:bogota weather:event [weather:temperature “10” ;weather:date ”18 June 2012”] .… what is the meaning of the strings?… how do I specify numbers?… how about dates?… how do I specify 10 degrees centigrade?Compact blanknode syntaxslide by Pedro Szekely
  68. 68. Typed Literalsgn:bogota weather:event [weather:temperature “10”^^<http://www.w3.org/2001/XMLSchema#integer> ;weather:date ”18 June 2012” ;] .URI specifies the typeslide by Pedro Szekely
  69. 69. Typed Literalsgn:bogota weather:event [weather:temperature “10”^^<http://www.w3.org/2001/XMLSchema#integer> ;weather:date ”18 June 2012” ;weather:date ”2012-06-18” ^^xsd:date ;] .… No set of predefined types defined in RDF… Software that consumes RDF must process types… XSD types commonly usedURI from the XML Schemanamespace are popularslide by Pedro Szekely
  70. 70. Containers and Collections
  71. 71. Bag, Sequence, Alternative<…> “…”rdf:Bag<…><…>rdf:_1rdf:_2rdf:_nrdf:Seq rdf:Altrdf:typeElements, can be URIor literalContainer, often a blank nodeKinds of containersProperties for storingelements in containersslide by Pedro Szekely
  72. 72. Bag Exampleexstaff:Sue exterms:publication _:z ._:z rdf:type rdf:Bag ._:z rdf:_1 ex:AnthologyOfTime ._:z rdf:_2 ex:ZoologicalReasoning ._:z rdf:_3 ex:GravitationalReflections .“Three papers that Sue published”slide by Pedro Szekely
  73. 73. What’s the Difference?exstaff:Sue exterms:publication _:z ._:z rdf:type rdf:Bag ._:z rdf:_1 ex:AnthologyOfTime ._:z rdf:_2 ex:ZoologicalReasoning ._:z rdf:_3 ex:GravitationalReflections .exstaff:Sue exterms:publication ex:AnthologyOfTime .exstaff:Sue exterms:publication ex:ZoologicalReasoning .exstaff:Sue exterms:publication ex:GravitationalReflections .slide by Pedro Szekely
  74. 74. Containers vs CollectionsOpen World Closed WorldIncomplete information Complete InformationThere are things I don’t know If I don’t know it, it does not existScales to the whole Web Does not scaleRDF philosophyContainers Collectionsopen world sets closed world setsslide by Pedro Szekely
  75. 75. Reification
  76. 76. Why Do We Need Reification?“On June 19 2012, Claudia said thatPedro’s email address is szekely1401@gmail.com”English<http://szekelys.com/family#pedro> foaf:mbox <szekely1401@gmail.com>RDFCorrect? …………………..… No!We need to make a statement about a statementslide by Pedro Szekely
  77. 77. Reification“On June 19 2012, Claudia said thatPedro’s email address is szekely1401@gmail.com”English_:s rdf:subject <http://szekelys.com/family#pedro> ._:s rdf:predicate foaf:mbox ._:s rdf:object <szekely1401@gmail.com> ._:s dcterms:date “2012-06-19”^^xsd:date ._:s dcterms:creator <http://uniandes.edu.co/faculty#claudiaj> .RDFslide by Pedro Szekely
  78. 78. Problems With Reification_:s rdf:subject <http://szekelys.com/family#pedro> ._:s rdf:predicate foaf:mbox ._:s rdf:object <szekely1401@gmail.com> ._:s dcterms:date “2012-06-19”^^xsd:date ._:s dcterms:creator <http://uniandes.edu.co/faculty#claudiaj> .<http://szekelys.com/family#pedro> foaf:mbox <szekely1401@gmail.com>RDF 1 implies RDF 2?RDF 1RDF 2…..… No!slide by Pedro Szekely
  79. 79. Problems With Reification• Needs 3 times more triples• Most software cannot reason with it• Nice idea that does not work well!• Don’t use it, there is a better way_:s rdf:subject <http://szekelys.com/family#pedro> ._:s rdf:predicate foaf:mbox ._:s rdf:object <szekely1401@gmail.com> ._:s dcterms:date “2012-06-19”^^xsd:date ._:s dcterms:creator <http://uniandes.edu.co/faculty#claudiaj> .slide by Pedro Szekely
  80. 80. RDF Syntax
  81. 81. RDF SyntaxesLeverages XML toolsHard for humans to readXMLN3, TurtleN-TriplesTerse RDF Triple LanguageHuman readable formatWorks with software tooSubset of turtle, supports streamingStandard for large RDF dumpsRDFaAllows embedding RDF in HTML pagesOriginal, stillused, but othersbecoming morepopularslide by Pedro Szekely
  82. 82. Turtle Syntaxhttp://www.w3.org/TR/2011/WD-turtle-20110809/
  83. 83. Turtle URIs aka IRI<http://example.org/path/><http://example.org/path/#fragment></path><#fragment><>URIs are in <>AbsoluteRelativeto thebasedocumentslide by Pedro Szekely
  84. 84. Turtle Prefixes (Namespaces)@prefix foo: <http://example.org/ns#> .@prefix : <http://other.example.org/ns#> .foo:bar foo: : .:bar : foo:bar .Expands toEmptyprefixhttp://example.org/ns#bar http://example.org/ns http://other.example.org/ns .slide by Pedro Szekely
  85. 85. Turtle Literals"a string”"""a string""”"""a stringwith newlines"""Strings in “”or write them in “””… so you can breakthem in multiple linesslide by Pedro Szekely
  86. 86. Turtle Literals"That Seventies Show""That Seventies Show"@en"Cette Série des Années Soixante-dix"@fr"Cette Série des Années Septante"@fr-be"mylexicaldata"^^<http://example.org/my/datatype>"""10"""^^xsd:decimal- untyped (“London” equivalent to “London”^^xsd:string)language tagdata type- language tag- data type (with a URI)Kinds of literals:slide by Pedro Szekely
  87. 87. Turtle Blank Nodes_:me_:a1234[]two blank nodesBlank nodes_:me foaf:firstName “Pedro” ._:me foaf:lastName “Szekely” .[] foaf:firstName “Pedro” .[] foaf:lastName “Szekely” .[ foaf:firstName “Pedro” ;foaf:lastName “Szekely” ;]Examplesslide by Pedro Szekely
  88. 88. Turtle Base URI</path><#fragment><>RDF document stored at http://isi.edu/szekely/example.rdf</path><#fragment><><http://isi.edu/szekely/example/path><http://isi.edu/szekely/example/#fragment><http://isi.edu/szekely/example>slide by Pedro Szekely
  89. 89. Turtle Base URI# this is a complete turtle document# In-scope base URI is the document URI at this point<a1> <b1> <c1> .@base <http://example.org/ns/> .# In-scope base URI is http://example.org/ns/ at this point<a2> <http://example.org/ns/b2> <c2> .@base <foo/> .# In-scope base URI is http://example.org/ns/foo/ at this point<a3> <b3> <c3> .@prefix : <bar#> .:a4 :b4 :c4 .@prefix : <http://example.org/ns2#> .:a5 :b5 :c5 .<a2> is <http://example.org/ns/a2><a3> is <http://example.org/ns/foo/a3>:a4 is <http://example.org/ns/foo/bar#a4>:a5 is <http://example.org/ns2#a5>slide by Pedro Szekely
  90. 90. Turtle “Type” Shortcuthttp://szekelys.com/family#pedro <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> foaf:Person .You can write:http://szekelys.com/family#pedro rdf:type foaf:Person .You can abbreviate it to:http://szekelys.com/family#pedro a foaf:Person .Or even better:slide by Pedro Szekely
  91. 91. Turtle Literals Revisited-50110+1Integers:"-5"^^xsd:integer"10"^^<http://www.w3.org/2001/XMLSchema#integer>Integers the hard way:0.01.01.234567890123456789-5.01.3e210e0-12.5e10Floating Point:"1.3e2"^^xsd:double"-5.0"^^<http://www.w3.org/2001/XMLSchema#decimal>Floating point the hard way:truefalseBooleans:"true"^^xsd:booleanBooleans the hard way:slide by Pedro Szekely
  92. 92. Turtle Triple Abbreviations:subject :predicate :object-1 .:subject :predicate :object-2 .:subject :predicate :object-1, :object-2 .:subject :predicate-1 :object-1 .:subject :predicate-2 :object-2 .:subject:predicate-1 :object-1 ;:predicate-2 :object-2 .slide by Pedro Szekely
  93. 93. XML to N3 Converterhttp://www.mindswap.org/2002/rdfconvert/ slide by Pedro Szekely

×