Presentation is loading. Please wait.

Presentation is loading. Please wait.

Resource Description Framework

Similar presentations


Presentation on theme: "Resource Description Framework"— Presentation transcript:

1 Resource Description Framework
Semantic Web In Depth Resource Description Framework Dr Nicholas Gibbins –

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 data model Statements about resources in the form of S-P-O triples
Collection of RDF statements represents a labeled, directed graph Abstract model with several serialization (i.e. file) formats Resource Resource Resource subject object edited by RDF Semantics Pat Hayes predicate knows Nick Gibbins Resource

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

5 A family of data formats
RDF/XML is the normative (standard) syntax Supported by almost all tools Not human-friendly RDF/N3 family Compact, human-friendly, non-XML syntaxes Variable tool support N3, Turtle, Ntriples Other XML and non-XML syntaxes exist: TriX, JSON-LD, 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 urn:isbn: URI references (URIrefs) are URIs with optional fragment identifiers

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=“ namespace URI prefix namespace abbreviation rdf:type becomes

10 RDF/XML

11 RDF/XML 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 version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ <dc:title> </dc:title> </rdf:Description> </rdf:RDF> Triple predicate <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ <dc:title>Scientific American</dc:title> </rdf:Description> </rdf:RDF> Triple object <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ </rdf:RDF> Other namespace declarations <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ </rdf:Description> </rdf:RDF> Triple subject <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ </rdf:RDF> RDF namespace declaration <?xml version=“1.0”?> XML declaration <?xml version=“1.0”?> <rdf:RDF </rdf:RDF> RDF document element Scientific American

13 The anatomy of an RDF/XML file
Resource-valued predicates use the rdf:resource attribute <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ <dc:creator </rdf:Description> </rdf:RDF>

14 The anatomy of an RDF/XML file
We can have multiple rdf:Description elements within an rdf:RDF element <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ <dc:title>Example Inc. Homepage</dc:title> </rdf:Description> <dc:creator </rdf:RDF> Example Inc. Homepage

15 The anatomy of an RDF/XML file
We can have multiple predicates within an rdf:Description element <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ <dc:title>Example Inc. Homepage</dc:title> <dc:creator </rdf:Description> </rdf:RDF> Example Inc. Homepage

16 Class membership An object’s membership of a class is indicated using the rdf:type property <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ <rdf:Description rdf:about=“ <rdf:type rdf:resource=“ </rdf:Description> </rdf:RDF> rdf:type ex:Website

17 Abbreviated forms – class membership
Replace rdf:Description with QName of class <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:ex=“ <ex:Website rdf:about=“ </rdf:RDF> rdf:type ex:Website

18 RDF/XML striped syntax
Consider the following graph: John Smith

19 RDF/XML striped syntax
Graph could be serialised using two rdf:Description elements <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator </rdf:Description> <rdf:Description <ex:name>John Smith</ex:name> </rdf:RDF>

20 RDF/XML striped syntax
Alternatively, the second statement could be inserted within the predicate element of the first <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator> <rdf:Description <ex:name>John Smith</ex:name> </rdf:Description> </dc:creator> </rdf:RDF>

21 RDF/XML striped syntax
The syntax is striped because property and class elements are nested alternately <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator> <rdf:Description <ex:name>John Smith</ex:name> </rdf:Description> </dc:creator> </rdf:RDF> <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator> <rdf:Description <ex:name>John Smith</ex:name> </rdf:Description> </dc:creator> </rdf:RDF>

22 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) <?xml version=“1.0”?> <!DOCTYPE rdf:RDF [ <!ENTITY rdf ‘ <!ENTITY dc ‘ <!ENTITY ex ‘ ]> <rdf:RDF xmlns:rdf=“&rdf;” xmlns:dc=“&dc;” xmlns:ex=“&ex;”>

23 Common RDF idioms Assertions about the null URIref are about the RDF file itself <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“”> <dc:creator </rdf:Description> </rdf:RDF>

24 Blank nodes (bNodes) Sometimes we have resources which we do not wish to identify with a URI These are blank nodes or anonymous resources John Smith

25 Blank nodes (bNodes) The striped syntax simplifies the RDF/XML serialisation – remove the rdf:about attribute <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator> <rdf:Description> <ex:name>John Smith</ex:name> </rdf:Description> </dc:creator> </rdf:RDF>

26 Blank nodes (bNodes) The striped syntax is not sufficient to represent all graphs containing blank nodes unambiguously dc:creator John Smith ex:name dc:creator

27 Blank nodes (bNodes) <?xml version=“1.0”?>
<rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator> <rdf:Description> <ex:name>John Smith</ex:name> </rdf:Description> </dc:creator> <rdf:Description rdf:about=“ </rdf:RDF>

28 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

29 Blank nodes and node IDs
<?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ xmlns:ex=“ <rdf:Description rdf:about=“ <dc:creator rdf:nodeID=“foo23”/> </rdf:Description> <rdf:Description rdf:about=“ <rdf:Description rdf:nodeID=“foo23”> <ex:name>John Smith</ex:name> </rdf:RDF>

30 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 declares a new URIref Analogous to the name and id attributes in HTML Relative to xml:base attribute <rdf:Description rdf:ID=“JohnSmith”>

31 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 <rdf:Description rdf:about=“ <dc:date rdf:datatype=“ </rdf:Description>

32 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 <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:dc=“ <rdf:Description rdf:about=“ <dc:title xml:lang=“en”>Foreword</dc:title> <dc:title xml:lang=“fr”>Avant-propos</dc:title> </rdf:Description> </rdf:RDF>

33 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:Bag rdf:_1 rdf:type rdf:_2 ex:members rdf:_3

34 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)

35 Containers Special syntax for expressing collections
rdf:li is a convenience element which is replaced with ordinal elements by RDF parsers <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:ex=“ <rdf:Description rdf:about=“ <ex:members> <rdf:Bag> <rdf:li <rdf:li <rdf:li </rdf:Bag> </ex:members> </rdf:Description> </rdf:RDF>

36 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

37 Collections rdf:List ex:members rdf:type http://www.example.org/
rdf:first rdf:rest rdf:first rdf:rest rdf:first rdf:rest rdf:nil

38 Collections As before, special syntax for expressing collections
rdf:parseType indicates special parse rules for an element <?xml version=“1.0”?> <rdf:RDF xmlns:rdf=“ xmlns:ex=“ <rdf:Description rdf:about=“ <ex:members rdf:parseType=“Collection”> <rdf:Description <rdf:Description <rdf:Description </ex:members> </rdf:Description> </rdf:RDF>

39 The RDF/N3 family

40 Ntriples, N3 and Turtle Simpler syntaxes than RDF/XML (hurrah!)
Ntriples is the simplest (a subset of Turtle) N3 and Turtle are more concise Turtle is the standard version of N3 General syntax for a triple: <subject> <predicate> <object> . Resources are indicated <like this> Literals are indicated “like this”

41 The anatomy of an NTriples file
< < “Scientific American” . Scientific American

42 The anatomy of an Turtle/N3 file
< < ; < “Example Inc. Homepage” . “;” allows grouping of triples with common subject Example Inc. Homepage

43 The anatomy of a Turtle/N3 file
< < , . “,” allows grouping of triples with common subject and predicate Example Inc. Homepage

44 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 .

45 Common RDF/N3 idioms @base used to introduce a base URI relative to which all URI fragment identifiers are expanded (similar to use of xml:base in RDF/XML): @base < . @prefix foaf: < <#john> foaf:name “John Smith” . contains the triple: < < “John Smith” .

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

47 Further Reading

48 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 from in 2011 until 2013 New standard syntaxes (Turtle, JSON) Multiple graphs and graph stores

49 RDF references RDF homepage at W3C RDF Core Working Group homepage
RDF Core Working Group homepage RDF Working Group homepage RDF/N3 Primer XML Schema Part 2: Datatypes


Download ppt "Resource Description Framework"

Similar presentations


Ads by Google