Download presentation
Presentation is loading. Please wait.
1
Dr. Alexandra I. Cristea http://www.dcs.warwick.ac.uk/~acristea/ RDF
2
2 RDF Definition The Resource Description Framework (RDF) is a W3C standard for describing resources on the Web. RDF is a framework for describing Web resources, –e.g., title, author, modification date, content, and copyright information of a Web page.
3
3 RDF original purpose & the metadata originally created in 1999 as a standard on top of XML, for encoding metadata –literally, data about data. –e.g., who authored a web page, what date a blog entry was published, etc., –secondary info
4
RDF general information on standard evolution http://www.w3.org/standards/techs/rdf 4
5
5 What (else) is RDF? RDF provides a model for data, and a syntax so that independent parties can exchange and use it RDF is designed to be read and understood by computers RDF is not designed for being displayed to people RDF (can be) written in XML RDF is a part of the W3C's Semantic Web Activity RDF is a W3C Recommendation (so a standard!) http://www.w3.org/RDF/
6
6 RDF Usage Examples Describing properties for shopping items, such as price and availability Describing time schedules for web events Describing information about web pages, such as content, author, created and modified date Describing content and rating for web pictures Describing content for search engines Describing electronic libraries
7
7 RDF is Designed to be Read by Computers RDF was designed to provide a common way to describe information so it can be read and understood by computer applications. RDF descriptions are not designed to be displayed on the web.
8
8 RDF and "The Semantic Web" 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
9
9 RDF Statements RDF is built of Statement s known as the –subject, –predicate and –object (of a Statement).
10
10 RDF Statements Subject Predicate Object
11
Informal graph of sample triples 11
12
Subjects and Objects Resources and values IRI Literals Blank nodes Let’s understand them: 12
13
IRI, URI, URL International Resource Identifier Uniform Resource Identifier Uniform Resource Locator The IRI for an INA video about the Mona Lisa entitled 'La Joconde à Washington' in Europeana is: http://data.europeana.eu/item/04802/243FA8618938 F4117025F17A8B813C5F9AA4D619INAEuropeana http://data.europeana.eu/item/04802/243FA8618938 F4117025F17A8B813C5F9AA4D619 13
14
IRI are global identifiers, so other people can re-use this IRI to identify the same thing. IRI used as an RDF property to state acquaintance relationship : –http://xmlns.com/foaf/0.1/knowshttp://xmlns.com/foaf/0.1/knows DBpedia uses IRIs for articles:DBpedia –http://dbpedia.org/resource/Name 14
15
Literals Basic values that are not IRI Examples –"La Joconde", –"the 4th of July, 1990" –"3.14159“ associated with a datatypedatatype Strings optionally assoc. with language tag.language tag –"Léonard de Vinci" - "fr" language tag –" 李奥纳多 · 达 · 文西 " - "zh" language tag. 15
16
Blank nodes When mentioning resources without global identifier ~ variables in algebra 16
17
Multiple graphs 17
18
18 Example using URIs Let's look at some example statements to get a better understanding: –Statement: "The author of http://www.w3schools.com/RDF is Jan Egil Refsnes". –Statement: "The homepage of http://www.w3schools.com/RDF is http://www.w3schools.com".
19
19 Example – cont. Statement: "The author of http://www.w3schools.com/RDF is Jan Egil Refsnes". –The subject of the statement above is: http://www.w3schools.com/RDF –The predicate is: author –The object is: Jan Egil Refsnes Statement: "The homepage of http://www.w3schools.com/RDF is http://www.w3schools.com". –The subject of the statement above is: http://www.w3schools.com/RDF –The predicate is: homepage –The object is: http://www.w3schools.com
20
20 RDF Statements Subject Predicate author http://www.w3schools.com/RDF Object Jan Egil Refsnes
21
21 RDF Resource, Property, and 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 "http://www.w3schools.com/RDF" 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 Egil Refsnes" or "http://www.w3schools.com" (note that a property value can be another resource)
22
22 RDF Statements Subject Predicate author http://www.w3schools.com/RDF Resource Property Can be another resource !! Object Jan Egil Refsnes Property Value
23
23 Example
24
RDF vocabulary examples "Friend of a Friend" (FOAF)"Friend of a Friend" Dublin Core – web resourcesDublin Core schema.org – mark up by search providersschema.org SKOS – classification schemes for librariesSKOS 24
25
25 So, RDF.. Different world view Triples (instead of pairs) More natural? This is the concept … how to implement it?
26
Writing RDF graphs Turtle family of RDF languages (N- Triples, Turtle, TriG and N-Quads);N- TriplesTurtleTriGN-Quads JSON-LD (JSON-based RDF syntax);JSON-LD RDFa (for HTML and XML embedding);RDFa RDF/XML (XML syntax for RDF).RDF/XML 26
27
27 RDF can be Written in XML RDF documents can be written in XML language : RDF/XML. information exchange between –different types of computers –types of operating systems and –application languages.
28
28 RDF/XML http://www.w3.org/TR/2014/REC-rdf- syntax-grammar-20140225/ http://www.w3.org/TR/2014/REC-rdf- syntax-grammar-20140225/
29
RDF 1.1 XML Syntax 29 Original version 1999; most recent recommendation 25 th of February 2014 Encodes RDF graphs Nodes and predicates need represented in XML terms element names, attribute names, element contents, attribute values
30
RDF/XML is XML 30
31
31 XML Rules 1.Every start-tag must have a matching end-tag. 2.Tags cannot overlap. Proper nesting is required. 3.XML documents can only have one root element. 4.Element names must obey the following XML naming conventions: a)Names must start with letters or the "_" character. Names cannot start with numbers or punctuation characters. b)After the first character, numbers and punctuation characters are allowed.
32
32 XML Rules (cont.) c)Names cannot contain spaces. d)Names should not contain the ":" character as it is a "reserved" character. e)Names cannot start with the letters "xml" in any combination of case. f)The element name must come directly after the "<" without any spaces between them. 5.XML is case sensitive. 6.XML preserves white space within text. 7.Elements may contain attributes. If an attribute is present, it must have a value, even if it is an empty string "".
33
33 Example RDF/XML http://www.w3schools.com Resource Property Jan Egil Refsnes Property value
34
34 RDF/XML Is not the only solution, but the recommended one No one-to-one mapping –RDF doesn’t have ordering –XML does! –Serialization of a graph! –So is this the price to pay? Others: Notation 3 http://www.w3.org/DesignIssues/Notation3.html, precursor to Turtle http://www.dajobe.org/2004/01/turtle/ http://www.w3.org/DesignIssues/Notation3.htmlhttp://www.dajobe.org/2004/01/turtle/
35
XML has namespaces: Why namespaces? 35
36
36 Naming ambiguity
37
37 The Idea to Solve it Assign a URI (~ URL) to every sub- language: –E.g., for XHTML 1.0: http://www.w3.org/1999/xhtml Qnames: Qualify element names with URIs: –{http://www.w3.org/1999/xhtml}head Web Naming and Addressing Overview (URIs, URLs,...)
38
38 The actual solution Namespace declarations bind URIs to prefixes: Default namespace (no prefix) declared with: xmlns=“…” Lexical Scope Attribute names can also be prefixed
39
39 Applying namespaces
40
40 RDF/XML namespace
41
41 Other namespaces
42
Example: Mona Lisa <rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:schema="http://schema.org/"> 1990-07- 04 Mona Lisa 42
43
43 RDF Online Validator W3C's RDF Validation Service is useful when learning RDF. Here you can experiment with RDF files.W3C's RDF Validation Service The online RDF Validator parses your RDF document, checks your syntax, and generates tabular and graphical views of your RDF document.
44
44 The Element 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... Description goes here
45
45 The Element The element identifies a resource with the about attribute. The element contains elements that describe the resource. Bob Dylan USA Columbia 10.90 1985
46
46 A Resource and its Description …...
47
47 Another example TitleArtistCountryCompanyPriceYear Empire BurlesqueBob DylanUSAColumbia10.901985 Hide your heartBonnie TylerUKCBS Records9.901988...
48
48 Bob Dylan USA Columbia 10.90 1985 Bonnie Tyler UK CBS Records 9.90 1988... RDF Declaration
49
49 Properties as Attributes The property elements can also be defined as attributes (instead of elements): Can you identify the triples here? (resource, property, value)
50
50 Properties as Resources The property elements can also be defined as resources:...
51
51 Compare: properties as elements Bob Dylan attributes resources
52
52 RDF Containers RDF containers are used to describe groups of things. e.g, to list the authors of a book or to list the members in a band. The following RDF elements are used to describe such groups:,, and.
53
53 RDF Bag The element is used to describe a list of values that is intended to be unordered. The element may contain duplicate values. John Paul George Ringo
54
54 Student example
55
55 RDF Bag
56
56 The Element The element is used to describe a list of values that is intended to be ordered (For example, in alphabetical order). The element may contain duplicate values. George John Paul Ringo
57
57 The Element The element is used to describe a list of alternative values (the user can select only one of the values). CD Record Tape
58
58 RDF Alt
59
59 The rdf:parseType="Collection" Attribute collection can be closed (container cannot ) RDF collections are used to describe a group that contains ONLY the specified members. A collection is described by the attribute rdf:parseType="Collection".
60
60 Collection attribute example
61
61 Collection: a graphical representation
62
62 Collection is a short notation
63
63 RDF Reification Statements about statements –E.g., record info about when statements were made, who made them, etc. ("provenance" information).
64
64 Example example.com could record the fact that: John Smith made the original statement about the tent's weight By: –original statement URIref (exproducts:triple12345), describing it w. reification, then –adding an additional statement that exproducts:triple12345 was written by John Smith (w. URIref for John Smith)
65
65 Example figure: reification original statement John
66
Reification Rules For the given IRI event r and the statement with terms s, p and o corresponding to the N-Triples: s p o. add the following statements to the graph: r.string-value s.string-value r.string-value p.string-value r.string-value o.string-value r.string-value.string-value 66
67
67 RDF Schema and Application Classes RDF describes resources with classes, properties, and values RDF needs to define application- specific classes and properties –with extensions to RDF One such extension is RDF Schema
68
RDF Schema http://www.w3.org/TR/2014/REC-rdf- schema-20140225/ http://www.w3.org/TR/2014/REC-rdf- schema-20140225/ 68
69
RDF Schema W3C recommendation since 2004; newest 25 th February 2014 RDF Schema 1.1 provides a data-modelling vocabulary for RDF data. is an extension of the basic RDF vocabulary. 69
70
70 RDF Schema (RDFS) does not provide actual application- specific classes and properties. … but framework to describe them Classes ~ OO programming languages. Resources: –instances of classes, or –subclasses of classes.
71
71 RDFS Example The following example demonstrates some of the RDFS facilities: In the example above, the resource "horse" is a subclass of the class "animal".
72
72 Example of class structure
73
73 Multiple inheritance!
74
74 Example Abbreviated Since an RDFS class is an RDF resource we can abbreviate it using rdfs:Class instead of rdf:Description, and drop the rdf:type information
75
75 Original Class declaration <rdf:RDF xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base= "http://www.animals.fake/animals#">
76
76 Example Class Abbreviated <rdf:RDF xmlns:rdf= "http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xml:base= "http://www.animals.fake/animals#">
77
77 Original and abbreviated class So we replace: with
78
78 Classes rdfs:Resource rdfs:Class rdfs:Literal rdfs:Datatype rdf:XMLLiteral rdf:Propertyrdfs:Resourcerdfs:Classrdfs:Literalrdfs:Datatyperdf:XMLLiteralrdf:Property
79
79 Properties rdfs:range rdfs:domain rdf:type rdfs:subClassOf rdfs:subPropertyOf rdfs:label rdfs:commentrdfs:rangerdfs:domainrdf:typerdfs:subClassOfrdfs:subPropertyOfrdfs:labelrdfs:comment
80
80 RDF Conclusion We have learned: –RDF –Usage scenarios, basics –RDFS and examples –Comparison w. XML and graph languages
81
Homework Lists 10 URI that identify things in your environment. Give several examples of how to extend the definition of literals in RDF. Why would this be useful? The RDFS specification allows more than one domain to be defined for a property and uses the intersection of these domains. Discuss the pros and cons of taking the union versus taking the intersection of domains. In an older version of the RDFS specfication, rdfs:subClassOf was not allowed to have cycles. Try to imagine situations where a cyclic clas relationship would be beneficial. (Hint: Think of equivalences between classes) Discuss the differences between the following statements, and draw graphs to illustrate the difference: X supports the proposal; Y supports the proposal; Z supports the proposal. The group of X, Y and Z supports the proposal. 81
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.