semantic web data management rdf sparql n.
Skip this Video
Loading SlideShow in 5 Seconds..
Semantic Web Data Management ---RDF & SPARQL PowerPoint Presentation
Download Presentation
Semantic Web Data Management ---RDF & SPARQL

Semantic Web Data Management ---RDF & SPARQL

185 Vues Download Presentation
Télécharger la présentation

Semantic Web Data Management ---RDF & SPARQL

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. 北京大学计算机科学技术研究所 Institute of Computer Science and Technology of Peking University Semantic Web Data Management---RDF & SPARQL Instructor: Lei Zou

  2. Outline RDF SPARQL Linked Data

  3. Outline RDF SPARQL Link Data RDF Storage

  4. Semantic Web “Semantic Web Technologies” is a collection of standard technologies to realize a Web of Data

  5. RDF The Resource Description Framework (RDF) is a family of World Wide Web Consortium (W3C) specifications originally designed as a metadata data model. It has come to be used as a general method for conceptual description or modeling of information that is implemented in web resources, using a variety of syntax formats.(

  6. A Simple Example namespace Subject Property Object Syntax Level: <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:si=""><rdf:Descriptionrdf:about="">  <si:title> W3Schools </si:title>  <si:author>Jan EgilRefsnes </si:author></rdf:Description></rdf:RDF>

  7. A Simple Example The title of is “W3CSchools”, and its author is “Jan EgilRefsnes” ----- Natural Language Semantic Level

  8. A Simple Example Graph Model “Jan EgilRefsnes” si:author si:title “W3Schools”

  9. What is RDF? RDF is a general data model. RDF stands for Resource Description Framework RDF is a framework for describing resources on the web RDF is designed to be read and understood by computers RDF is not designed for being displayed to people RDF is written in XML (this is not necessary condition) RDF is a part of the W3C's Semantic Web Activity

  10. Use Examples Describing properties for shopping items, such as price and availability Describing time schedules for web events Describing information about web pages (content, author, created and modified date) Describing content and rating for web pictures Describing content for search engines Describing electronic libraries

  11. RDF and "The Semantic Web" RDF provides a general model to describe Web Information. The RDF language is a part of the W3C's Semantic Web Activity. W3C's "Semantic Web Vision" is a future where: Web information has exact meaning Web information can be understood and processed by computers Computers can integrate information from the web

  12. Resource & Property & Property Value RDF identifies things using Web identifiers (URIs), and describes resources with properties and property values. A Resource is anything that can have a URI, such as "" A Property is a Resource that has a name, such as "author" or "homepage" A Property value is the value of a Property, such as "Jan EgilRefsnes" or "" (note that a property value can be another resource)

  13. RDF Statement The combination of a Resource, a Property, and a Property value forms a Statement (known as the <subject, predicate and object > of a Statement). Natural Language: "The author of is Jan EgilRefsnes". RDF Statement:, is:author, “Jan EgilRefsnes”

  14. <rdf:RDF> <rdf:RDF> is the root element of an RDF document. It defines the XML document to be an RDF document. It also contains a reference to the RDF namespace: Example: <?xml version="1.0"?><rdf:RDFxmlns:rdf="">  ...Description goes here...</rdf:RDF>

  15. <rdf:Description> The <rdf:Description> element identifies a resource with the about attribute. <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#> <rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Empire Burlesque"> <cd:artist>Bob Dylan</cd:artist>   <cd:country>USA</cd:country>   <cd:company>Columbia</cd:company>  <cd:price>10.90</cd:price>   <cd:year>1985</cd:year> </rdf:Description></rdf:RDF>

  16. Properties as Attributes <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#><rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Empire Burlesque"cd:artist="Bob Dylan" cd:country="USA"cd:company="Columbia" cd:price="10.90"cd:year="1985" /></rdf:RDF>

  17. Properties as Resources <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#><rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Empire Burlesque"> <cd:artist rdf:resource="http://www.recshop.fake/cd/dylan" />  ...</rdf:Description></rdf:RDF>

  18. The <rdf:Bag> Element <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#><rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Beatles">  <cd:artist>    <rdf:Bag>      <rdf:li>John</rdf:li>      <rdf:li>Paul</rdf:li>      <rdf:li>George</rdf:li>      <rdf:li>Ringo</rdf:li>    </rdf:Bag>  </cd:artist></rdf:Description></rdf:RDF>

  19. The <rdf:Seq> Element <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#><rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Beatles">  <cd:artist>    <rdf:Seq>      <rdf:li>George</rdf:li>      <rdf:li>John</rdf:li>      <rdf:li>Paul</rdf:li>      <rdf:li>Ringo</rdf:li>    </rdf:Seq>  </cd:artist></rdf:Description></rdf:RDF>

  20. The <rdf:Alt> Element <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#><rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Beatles">  <cd:format>    <rdf:Alt>      <rdf:li>CD</rdf:li>      <rdf:li>Record</rdf:li>      <rdf:li>Tape</rdf:li>    </rdf:Alt>  </cd:format></rdf:Description></rdf:RDF>

  21. An Example

  22. <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:cd=http://www.recshop.fake/cd#><rdf:Descriptionrdf:about="http://www.recshop.fake/cd/Empire Burlesque">  <cd:artist>Bob Dylan</cd:artist>  <cd:country>USA</cd:country>  <cd:company>Columbia</cd:company>  <cd:price>10.90</cd:price>  <cd:year>1985</cd:year></rdf:Description>…</rdf:RDF>

  23. W3C RDF  Validation Service

  24. RDF Schema RDF Schema does not provide actual application-specific classes and properties. Instead RDF Schema provides the framework to describe application-specific classes and properties.

  25. An Example- RDF Schema <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:rdfs=""xml:base=http://www.animals.fake/animals#><rdf:Descriptionrdf:ID="animal">  <rdf:typerdf:resource=""/></rdf:Description><rdf:Descriptionrdf:ID="horse"> <rdf:typerdf:resource=""/><rdfs:subClassOfrdf:resource="#animal"/></rdf:Description></rdf:RDF>

  26. An Example- RDF Schema <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:rdfs=""xml:base="http://www.animals.fake/animals#"><rdfs:Classrdf:ID="animal" /><rdfs:Classrdf:ID="horse">  <rdfs:subClassOfrdf:resource="#animal"/></rdfs:Class></rdf:RDF>

  27. RDF Schema Core Classes: rdfs:Resouce: The Class of all resouces; rdfs:Class: The Class of all classes; rdfs:Literal: The Class of all literals; rdf:Property: The Class of all properties;

  28. RDF Schema Core Property rdf:type: associate one resource and its class; rdfs:subClassOf: associate one class and its father class; rdfs:subPropertyOf: associate one property and its sub-property rdfs:domain: define the “definition domain” for some property; rdfs:range: define the “range domain” for some property;

  29. RDF Schema rdfs:seeAlso: specifies a resource that might provide additional information about the subject resource; rdfs:comment : This is used to provide a human-readable description of a resource rdfs:label: This is used to provide a human-readable version of a resource name.

  30. RDF Dublin Core Metadata The Dublin Core is a set of predefined properties for describing documents. The first Dublin Core properties were defined at the Metadata Workshop in Dublin, Ohio in 1995 and is currently maintained by the Dublin Core Metadata Initiative.

  31. RDF Dublin Core Metadata

  32. An Example <?xml version="1.0"?><rdf:RDFxmlns:rdf=""xmlns:dc= ""><rdf:Descriptionrdf:about=""><dc:description>W3Schools - Free tutorials</dc:description>  <dc:publisher>Refsnes Data as</dc:publisher>  <dc:date>2008-09-01</dc:date>  <dc:type>Web Development</dc:type>  <dc:format>text/html</dc:format>  <dc:language>en</dc:language></rdf:Description></rdf:RDF>

  33. DOAP Metadata Description of a Project (DOAP) is an RDF schema and XML vocabulary to describe software projects, and in particular open-source.(

  34. An Example <rdf:RDFxmlns:rdf="" xmlns:doap=""> <doap:Project> <doap:name>Example project</doap:name> <doap:homepagerdf:resource="" /> <doap:programming-language>javascript</programming-language> <doap:licenserdf:resource=""/> </doap:Project> </rdf:RDF>

  35. FOAF FOAF (an acronym of Friend of a friend) is a machine-readable ontology describing persons, their activities and their relations to other people and objects. Anyone can use FOAF to describe him or herself. FOAF allows groups of people to describe social networks without the need for a centralised database. More details can be founded at:

  36. An Example

  37. Outline RDF SPARQL Link Data RDF Storage

  38. What’s SPARQL SPARQL is an RDF query language; its name is a recursive acronym that stands for SPARQL Protocol and RDF Query Language. It was standardized by the RDF Data Access Working Group (DAWG) of the World Wide Web Consortium, and is considered a key semantic web technology. SPARQL allows for a query to consist of triple patterns, conjunctions, disjunctions, and optional patterns.

  39. Why SPARQL SPARQL is the query language of the Semantic Web. It lets us: Pull values from structured and semi-structured data Explore data by querying unknown relationships Perform complex joins of disparate databases in a single, simple query Transform RDF data from one vocabulary to another

  40. Structure of a SPARQL Query A SPARQL query comprises, in order: Prefix declarations, for abbreviating URIs Dataset definition, stating what RDF graph(s) are being queried A result clause, identifying what information to return from the query The query pattern, specifying what to query for in the underlying dataset Query modifiers, slicing, ordering, and otherwise rearranging query results

  41. # prefix declarations PREFIX foo: <> ... # result clause SELECT ... # dataset definition FROM ... # query pattern WHERE { ... } # query modifiers ORDER BY ...

  42. SPARQL Architecture & Endpoints • SPARQL queries are executed against RDF datasets, consisting of RDF graphs. • A SPARQL endpoint accepts queries and returns results via HTTP. • Generic endpoints will query any Web-accessible RDF data • Specific endpoints are hardwired to query against particular datasets

  43. An Example FOAF is a standard RDF vocabulary for describing people and relationships Tim Berners-Lee's FOAF information available at

  44. An Example PREFIX foaf: <> select ?name from <> where {?a foaf:name ?name. } Finding all names in dataset

  45. An Example PREFIX foaf: <> PREFIX doap: <> select ?a from <> where { <> doap:developer ?a. } Finding who is the developer of Tabulator Try it on a Generic endpoint.

  46. An Example – conjunctive query #Tabulator ?a ?name doap:developer foaf:name PREFIX foaf: <> PREFIX doap: <> select ?name from <> where { <> doap:developer ?a. ?a foaf:name ?name}

  47. An Example – conjunctive query ?name foaf:name ?a ?email foaf:email PREFIX foaf: <> PREFIX doap: <> select ?name ?email from <> where { ?person foaf:name ?name. ?person foaf:mbox ?email}

  48. Dataset: DBPedia DBPedia is an RDF version of information from Wikipedia. DBPedia contains data derived from Wikipedia's infoboxes, category hierarchy, article abstracts, and various external links. DBpedia contains over 100 million triples. a DBPedia-specific SPARQL endpoint.

  49. Dataset: DBPedia DBPedia is an RDF version of information from Wikipedia. DBPedia contains data derived from Wikipedia's infoboxes, category hierarchy, article abstracts, and various external links. DBpedia contains over 100 million triples. a DBPedia-specific SPARQL endpoint.