Presentation is loading. Please wait.

Presentation is loading. Please wait.

Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins – 2013-2014.

Similar presentations


Presentation on theme: "Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins – 2013-2014."— Presentation transcript:

1 Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins – nmg@ecs.soton.ac.uk 2013-2014

2 What is the Resource Description Framework? A standard data model for the Semantic Web A knowledge representation language A family of data formats and notations

3 A standard data model Recall that the Semantic Web uses subject-predicate-object triples as its standard representation: This data model is independent of the syntax used to express (serialise) those triples. RDF Semantics Pat Hayes edited by subjectpredicateobject

4 XML + Namespaces URIUnicode SignatureEncryption Rules Proof Trust RDF RDF Schema OWL SPARQL (queries) User Interface and Applications A knowledge representation language RDF is used as the foundation for the other knowledge representation and ontology languages on the Semantic Web

5 A family of data formats RDF/XML is the normative (standard) syntax –Supported by almost all tools RDF/N3 (Notation3) is also widely used –Non-XML syntax –Variable tool support –Primarily designed to be easy to write on whiteboards Other XML and non-XML syntaxes exist: –Turtle, NTriples, TriX etc

6 RDF Requirements

7 RDF requirements A means for identifying objects and vocabulary terms (URIs) A means for distinguishing between terms from different vocabularies (XML namespaces and qualified names) A means for serialising triples (XML)

8 URIs and URIrefs Standard identifiers for the Semantic Web Uniform Resource Identifiers are defined by RFC2396 –http://example.org/ –urn:isbn:0198537379 –mailto:nmg@ecs.soton.ac.uk URI references (URIrefs) are URIs with optional fragment identifiers –http://example.org/index.html#Introduction –http://www.w3.org/1999/02/22-rdf-syntax-ns#type

9 XML namespaces and qualified names RDF uses XML namespaces to refer to elements of domain vocabularies Namespaces used to abbreviate URIrefs to qualified names (QNames) QNames cannot be used in attribute values in RDF/XML –Use the URIref instead xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax- ns#” namespace URI prefix namespace abbreviation http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:type becomes

10 RDF/XML

11 RDF/XML is an XML-based format for expressing a collection of RDF triples (an RDF graph) Can be parsed by an XML parser to give an XML data model (Document Object Model, XML Infoset) Can be parsed by an RDF parser to give an RDF data model (an RDF graph)

12 The anatomy of an RDF/XML file XML declaration <rdf:RDF RDF document element <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” RDF namespace declaration <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Other namespace declarations <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Triple subject <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Triple predicate <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Scientific American Triple object http://purl.org/dc/elements/1.1/title http://www.sciam.com/ Scientific American

13 The anatomy of an RDF/XML file Resource-valued predicates use the rdf:resource attribute <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> http://purl.org/dc/elements/1.1/creator http://www.example.org/mailto:john@example.org

14 The anatomy of an RDF/XML file We can have multiple rdf:Description elements within an rdf:RDF element <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Example Inc. Homepage http://purl.org/dc/elements/1.1/creator http://www.example.org/mailto:john@example.org http://purl.org/dc/elements/1.1/title Example Inc. Homepage

15 The anatomy of an RDF/XML file We can have multiple predicates within an rdf:Description element <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Example Inc. Homepage http://purl.org/dc/elements/1.1/creator http://www.example.org/ mailto:john@example.org http://purl.org/dc/elements/1.1/title Example Inc. Homepage

16 Class membership An object’s membership of a class is indicated using the rdf:type property rdf:type http://www.example.org/ex:Website

17 Abbreviated forms – class membership Replace rdf:Description with QName of class <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:ex=“http://example.org/ontology#”> rdf:type http://www.example.org/ex:Website

18 Abbreviated forms – literal predicates Replace predicate element with attribute of same name on containing element <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> <rdf:Description rdf:about=“http://www.example.org/” dc:title=“Example Inc. Homepage”>

19 RDF/XML striped syntax Consider the following graph: http://purl.org/dc/elements/1.1/creator http://www.example.org/mailto:john@example.org http://example.org/ontology#name John Smith

20 RDF/XML striped syntax Graph could be serialised using two rdf:Description elements <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith

21 RDF/XML striped syntax Alternatively, the second statement could be inserted within the predicate element of the first <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith

22 RDF/XML striped syntax The syntax is striped because property and class elements are nested alternately <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith

23 Common RDF/XML idioms XML entities are defined for the XML namespace URI prefixes Used to abbreviate long URIrefs in attribute values (because QNames can’t be used there) <!DOCTYPE rdf:RDF [ ]> <rdf:RDF xmlns:rdf=“&rdf;” xmlns:dc=“&dc;” xmlns:ex=“&ex;”>

24 Common RDF idioms Assertions about the null URIref are about the RDF file itself <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”>

25 Blank nodes (bNodes) Sometimes we have resources which we do not wish to identify with a URI These are blank nodes or anonymous resources http://purl.org/dc/elements/1.1/creator http://www.example.org/ http://example.org/ontology#name John Smith

26 Blank nodes (bNodes) The striped syntax simplifies the RDF/XML serialisation – remove the rdf:about attribute <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith

27 Blank nodes (bNodes) The striped syntax is not sufficient to represent all graphs containing blank nodes unambiguously dc:creator http://www.example.org/ ex:name John Smith http://test.example.org/ dc:creator

28 Blank nodes (bNodes) <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith John Smith

29 Blank nodes and node IDs Ambiguities resulting from blank nodes are resolved by using node IDs Node IDs are identifiers which are local to a given serialisation of an RDF graph –Node IDs may not be referred to from outside the scope of the defining graph Node IDs are not guaranteed to remain unchanged when an RDF file is parsed and serialised –The identifier strings may change –but –The graph structure will remain unchanged

30 Blank nodes and node IDs <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/” xmlns:ex=“http://example.org/ontology#”> John Smith

31 rdf:about versus rdf:ID So far, we have used the rdf:about attribute to specify the subjects of triples –rdf:about takes a URIref as a value rdf:ID can be used to declare a new URIref within a document –Within the file http://www.example.org/ontology declares a new URIref http://www.example.org/ontology#JohnSmith –Analogous to the name and id attributes in HTML –Relative to xml:base attribute

32 Datatypes Literal values presented so far are plain and do not have a type –Many applications need to be able to distinguish between different typed literals RDF uses XML Schema datatypes <dc:date rdf:datatype=“http://www.w3.org/2001/XMLSchema#date”>2003-05-23

33 Multilingual support In addition to typed literals, RDF also provides support for language annotations on literals RDF uses XML’s multilingual support Languages identified by ISO369 two letter codes <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:dc=“http://purl.org/dc/elements/1.1/”> Foreword Avant-propos

34 Containers RDF provides means for describing groups of objects Membership in the group is denoted by the ordinal properties rdf:_1, rdf:_2, etc rdf:type http://www.example.org/mailto:bill@example.org ex:members mailto:sally@example.orgmailto:john@example.orgrdf:Bag rdf:_1 rdf:_2 rdf:_3

35 Containers Three types of container are available in RDF –rdf:Bag – an unordered group, possibly with duplicates –rdf:Seq – an ordered group –rdf:Alt – a group of alternatives (translations, media types, etc)

36 Containers Special syntax for expressing collections –rdf:li is a convenience element which is replaced with ordinal elements by RDF parsers <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:ex=“http://example.org/ontology#”>

37 Collections Collections are a different way of expressing ordered groups in RDF –Containers are mutable – a third party could add new members to a container –Collections are immutable – cannot be altered without rendering the collection ill-formed Similar to cons/car/cdr lists in Lisp

38 Collections rdf:type http://www.example.org/mailto:bill@example.org ex:members mailto:sally@example.orgmailto:john@example.orgrdf:Lis t rdf:first rdf:rest rdf:nil rdf:rest rdf:first

39 Collections As before, special syntax for expressing collections –rdf:parseType indicates special parse rules for an element <rdf:RDF xmlns:rdf=“http://www.w3.org/1999/02/22-rdf-syntax-ns#” xmlns:ex=“http://example.org/ontology#”>

40 The RDF/N3 family

41 The anatomy of an NTriples file “Scientific American”. http://purl.org/dc/elements/1.1/title http://www.sciam.com/ Scientific American

42 The anatomy of an Turtle/N3 file ; “Example Inc. Homepage”. “;” allows grouping of triples with common subject http://purl.org/dc/elements/1.1/creator http://www.example.org/mailto:john@example.org http://purl.org/dc/elements/1.1/title Example Inc. Homepage

43 Common RDF/N3 idioms @prefix used to introduce QName abbreviations to N3 and Turtle documents: @prefix rdf:. @prefix dc:. @prefix ex:. dc:creator ; rdf:type ex:Website.

44 bNodes in N3 and Turtle dc:creator [ ex:name “John Smith” ]. Or with nodeIDs: dc:creator _:foo23. _:foo23 ex:name “John Smith”.

45 Further Reading

46 RDF Status Original version published in 1999 Working group (RDF Core) formed in April 2001 Revised version published in early 2004 New RDF working group chartered in 2011 (runs until 2013) –New standard syntaxes (Turtle, JSON) –Multiple graphs and graph stores

47 RDF references RDF homepage at W3C –http://www.w3.org/RDF/ RDF Core Working Group homepage –http://www.w3.org/2001/sw/RDFCore/ RDF Working Group homepage –http://www.w3.org/2011/rdf-wg/ RDF/N3 Primer –http://www.w3.org/2000/10/swap/Primer.html XML Schema Part 2: Datatypes –http://www.w3.org/TR/xmlschema-2/


Download ppt "Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins – 2013-2014."

Similar presentations


Ads by Google