410 likes | 417 Views
e ce 627 intelligent web: ontology and beyond. lecture 4: rdf – basics and language. RDF basic ideas. the fundamental concepts of RDF resources properties statements. RDF basic ideas – resources. “ things ” we can/want to talk about
E N D
ece 627intelligent web: ontology and beyond lecture 4: rdf – basics and language
RDFbasic ideas the fundamental concepts of RDF • resources • properties • statements
RDFbasic ideas – resources • “things” we can/want to talk about • for example – authors, books, publishers, places, people, hotels, rooms, search queries … • anything that has an identity • every resource has a URI
RDFbasic ideas – resources URI (Uniform Resource Identifier) • a character string that identifies an abstract or physical resource on the Web • it can be a URL (Uniform Resource Locator) or some other kind of unique identifier
RDFbasic ideas – properties • special kind of resources • they describe relations between resources • for example, written by, age, title, … • also identify by URIs (and in practice by URLs)
RDFbasic ideas – statements • assert the properties of resources • it is a triple: object-attribute-value • in other words: resource-property-value values can either be resources or literals
RDFbasic ideas – statements – three views • a triple • a piece of a graph • a piece of XML code thus an RDF document can be viewed as: • a set of triples • a graph (semantic net) • an XML document
RDFbasic ideas – statement 1st view John Smith is the owner of the Web page http://www.ualberta.ca/~js (http://www.ualberta.ca/~js, http://www.mydomain.org/site-owner, #JohnSmith)
RDFbasic ideas – statement 1st view (http://www.ualberta.ca/~js, http://www.mydomain.org/site-owner, #JohnSmith) (x, P, y) – logical formula P(x, y) also (S, P, O) – Subject-Property-Object
RDFbasic ideas – general comment RDF offers only binary predicates (properties)
RDFbasic ideas – statement 2nd view a directed graph with labeled nodes and arcs • from the resource (the subject of the statement) • to the value (the object of the statement) in AI community it is known as a semantic net www.ualberta.ca/~js site-owner #JohnSmith
RDFbasic ideas – statement 2nd view (http://www.ualberta.ca/~js, http://www.mydomain.org/site-owner, #JohnSmith) (#JohnSmith, http://www.mydomain.org/phone, “7801234567”) (#JohnSmith, http://www.mydomain.org/uses, http://www.ualberta.ca/~mk/file.cgi) (http://www.ualberta.ca/~mk/file.cgi, http://www.mydomain.org/site-owner, “Mike Knot”)
RDFbasic ideas – statement 2nd view 7801234567 phone www.ualberta.ca/~js site-owner #JohnSmith uses Andrew Rock site-owner www.ualberta.ca/~mk/file.cgi
RDFbasic ideas – statement 3rd view <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mydomain="http://www.mydomain.org/my-rdf-ns"> <rdf:Description rdf:about="http://www.ualberta.ca/js"> <mydomain:site-owner rdf:resource=“#John Smith“/> </rdf:Description> </rdf:RDF>
RDFbasic ideas – reification it is possible to make statements about statements Mike believes that John Smith is the creator of the web page http://www.ualberta.ca/~js the solution: to assign a unique identifier to each statement, which can be used to refer to the statement
RDFbasic ideas – data types “7801234567” – integer or string? explicit information is needed to indicate that the literal is intended to represent a number, and which number the literal is supposed to represent – information about data type
RDFcritical view only binary relations (to express: X is the referee in a chess game between Y and Z – we need three triples: ref, player1, player2) properties a especial kind of resources statements about statements XML-based syntax of RDF not human-friendly
RDFXML-based syntax XML notation for RDF statements
RDFrunning example (http://www.cat.ca/docs#R20301, http://www.mydomain.org/creator, http://www.cat.ca/author#R051156) (http://www.cat.ca/docs#R20301, http://www.mydomain.org/title, “Karin Homepage”) (http://www.cat.ca/docs#R20301, http://www.mydomain.org/date, “2012-12-12”)
RDFrunning example - graph http://www.cat.ca/author#R051156 http://www.mydomain.org/creator http://www.cat.ca/docs#R20301 http://www.mydomain.org/date http://www.mydomain.org/title 2012-12-12 Karin Homepage
RDFrunning example 1 <?xml version=“1.0”?> 2 <rdf:RDF 3 xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#” 4 xmlns:md="http://www.mydomain.org/my-rdf-ns"> 5 <rdf:Description 6 rdf:about="http://www.cat.ca/docs#R20301"> 7 <md:creater 8 rdf:resource=“http://www.cat.ca/author#R051156“/> 9 </rdf:Description>
RDFrunning example 10 <rdf:Description 11 rdf:about="http://www.cat.ca/docs#R20301"> 12 <md:title>Karin Homepage</md:title> 13 </rdf:Description> 14 <rdf:Description 15 rdf:about="http://www.cat.ca/docs#R20301"> 16 <md:date>2012-12-12</md:date> 17 </rdf:Description> 18 </rdf:RDF>
RDFXML-based syntax line 3 and line 4: introduction of the rdf and md vocabularies so we can use abbreviated names line 5: rdf:Description – indication of the beginning of a new RDF statement line 6: rdf:about – indication of the subject of the RDF statement, its value is URI
RDFXML-based syntax line 7: md:creator – it is a name from a given vocabulary (here: mydomain), it is a property of the RDF statement line 8: rdf:resource – indication of the object of the RDF statement, its value is URI line 9: indicates that the definition of the RDF statement is completed
RDFXML-based syntax other lines – similar meaning line 12: md:title – it is a name from a given vocabulary (here: mydomain), it is a property of the RDF statement; this line contains the value “Karin Homepage” which the object
RDFXML-based syntax: first modification usage of relative URIs as a values of rdf:about or rdf:resource done with xml:base
RDFrunning example – after 1st modification 1 <?xml version=“1.0”?> 2 <rdf:RDF 3 xml:base=http://www.cat.ca/docs” 4 xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#” 5 xmlns:md="http://www.mydomain.org/my-rdf-ns"> 6 <rdf:Description rdf:about=”#R20301"> 7 <md:creater 8 rdf:resource=“http://www.cat.ca/author#R051156“/> 9 </rdf:Description>
RDFrunning example – after 1st modification 10 <rdf:Description rdf:about=”#R20301"> 11 <md:title>Karin Homepage</md:title> 12 </rdf:Description> 13 <rdf:Description rdf:about=”#R20301"> 14 <md:date>2012-12-12</md:date> 15 </rdf:Description> 16 </rdf:RDF>
RDFXML-based syntax: second modification rdf:ID that can be used as attribute of rdf:Description instead of rdf:about plus property elements can be nested within an rdf:Descirption element indicating that the properties apply to the same resource
RDFrunning example – after 2nd modification 1 <?xml version=“1.0”?> 2 <rdf:RDF xml:base=http://www.cat.ca/docs” 3 xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#” 4 xmlns:md="http://www.mydomain.org/my-rdf-ns"> 5 <rdf:Description rdf:ID=”R20301"> 6 <md:creater 7 rdf:resource=“http://www.cat.ca/author#R051156“/> 8 <md:title>Karin Homepage</md:title> 9 <md:date>2012-12-12</md:date> 10 </rdf:Description> 11 </rdf:RDF>
RDFXML-based syntax: third modification rdf:type the statement (S, rdf:type, O) indicates that resource O represents a category or a class of resources, of which resource S is an instance such resources are called typed node elements
RDFrunning example – after 3rd modification 1 <?xml version=“1.0”?> 2 <rdf:RDF xml:base=http://www.cat.ca/docs” 3 xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#” 4 xmlns:md=http://www.mydomain.org/my-rdf-ns> 5 <rdf:Description rdf:about=”#R20301"> 6 <rdf:type rdf:resource=“http://www.cat.ca/schema/PersonalDoc“/> 7 <md:creater 8 rdf:resource=“http://www.cat.ca/author#R051156“/> 9 <md:title>Karin Homepage</md:title> 10 <md:date>2012-12-12</md:date> 11 </rdf:Description> 12 </rdf:RDF>
RDFrunning example – after 3rd modification line 6: rdf:type – indication that Karin’s homepage is a personal document, which is represented as the name http://www.cat.com/schema/PersonalDoc (vocabulary is in www.cat.com/schema)
RDFXML-based syntax: forth modification rdf:type can be removed and the rdf:Description can be replaced by an element whose name is the name corresponding to the value of the removed rdf:type property
RDFrunning example – after 4th modification 1 <?xml version=“1.0”?> 2 <rdf:RDF xml:base=http://www.cat.ca/docs” 3 xmlns:cs=http://www.cat.ca/schema” 4 xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#” 5 xmlns:md=http://www.mydomain.org/my-rdf-ns> 6 <cs:PersonalDoc rdf:about=”#R20301”> 7 <md:creater 8 rdf:resource=“http://www.cat.ca/author#R051156“/> 9 <md:title>Karin Homepage</md:title> 10 <md:date>2012-12-12</md:date> 11</cs:PersonalDoc> 12 </rdf:RDF>
RDFXML-based syntax: fifth modification rdf:datatype is an attribute of a property element and assumes as value an XML Schema datatype
RDFrunning example – after 5th modification 1 <?xml version=“1.0”?> 2 <rdf:RDF xml:base=http://www.cat.ca/docs” 3 xmlns:cs=http://www.cat.ca/schema” 4 xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns#” 5 xmlns:md=http://www.mydomain.org/my-rdf-ns> 6 <cs:PersonalDoc rdf:about=”#R20301”> 7 <md:creater 8 rdf:resource=“http://www.cat.ca/author#R051156“/> 9 <md:title>Karin Homepage</md:title> 10 <md:date 11 rdf:datatype=“http://www.w3.org/2001/XMLSchema#date”> 12 2012-12-12 13 </md:date> 14</cs:PersonalDoc> 15 </rdf:RDF>
RDFXML-based syntax: reification to address needs of representing information about RDF statements themselves a description of a statement using RDF built-in vocabulary is called a reification of the statements
RDFXML-based syntax: reification rdf:Statement is a type, and there are the properties rdf:subject, rdf:predicate, and rdf:object
RDFXML-based syntax: reification example DocR20301 was created by AuthorR051156 (http://www.cat.ca/docs#R20301, http://www.mydomain.org/creator, http://www.cat.ca/author#R051156) Sam says that DocR20301 was created by AuthorR051156 ???
RDFXML-based syntax: reification example <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:my="http://www.mydomain.org/schema/"> <rdf:Description> <rdf:subject resource="http://www.cat.ca/docs#R20301" /> <rdf:predicate resource="http://www.mydomain.org/creator" /> <rdf:object>http://www.cat.ca/author#R051156</rdf:object> <rdf:type resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" /> <my:attributedTo>Sam</my:attributedTo> </rdf:Description> </rdf:RDF>