Upload
haracha
View
60
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Practical RDF Chapter 4. Specialized RDF Relationships: Reification, Containers, and Collections. Shelley Powers, O’Reilly SNU IDB Lab. Hyewon Lim. Outline. Containers Collections Reification. Containers. RDF Containers - PowerPoint PPT Presentation
Citation preview
Practical RDFChapter 4. Specialized RDF Relationships:Reification, Containers, and CollectionsShelley Powers, O’Reilly
SNU IDB Lab.Hyewon Lim
Outline Containers Collections Reification
2
Containers RDF Containers
– Specifically for handling multiple resources, or for handling multiple literals (properties)
– If you want to refer to the collection of items as a singular unit, you would use the Container
– E.g., A book created by several authors, a list of students in a course
RDF Container vocabulary– Bags– Sequences– Alternative and some associated properties
3
ContainersBag rdf:Bag
– Contains unordered lists of resources or literals– Duplicate data allowed– E.g., inventory of photographs
4
<?xml version=“1.0” ?><rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/>
<rdf:Description rdf:about=http://burningbird.net/earthstars/contest.htm> <pstcn:photos> <rdf:Bag> <rdf:li rdf:resource=“http://burningbird.net/earthstars/capo.jpg” /> <rdf:li rdf:resource=“http://burningbird.net/earthstars/baritea.jpg” /> <rdf:li rdf:resource=“http://burningbird.net/earthstars/cfluorite.jpg” /> <rdf:li rdf:resource=“http://burningbird.net/earthstars/ccinnibar.jpg” /> <rdf:li rdf:resource=“http://burningbird.net/earthstars/baryto.jpg” /> <rdf:li rdf:resource=“http://burningbird.net/earthstars/cbarite2a.jpg” /> </rdf:Bag> </pstcn:photos></rdf:Description>
</rdf:RDF>
If the container contained literals instead of resources as items: <rdf:li>Barite Photo</rdf:li>
ContainersSequence rdf:Seq
– Contains ordered list of resources or literals Ordering of the elements is indicated by the ordering of the
rdf:_n
– Duplicate resources or literals are allowed– E.g., web pages within a menu on the main web page
5
<?xml version=“1.0” ?><rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/>
<rdf:Description rdf:about=http://burningbird.net/earthstars/contest.htm> <pstcn:menu> <rdf:Seq> <rdf:li rdf:resource=“http://burningbird.net/articles.htm” /> <rdf:li rdf:resource=“http://burningbird.net/dynatech.htm” /> <rdf:li rdf:resource=“http://burningbird.net/interact.htm” /> </rdf:Seq> </pstcn:menu></rdf:Description>
</rdf:RDF>
ContainersAlternative rdf:Alt
– Provides alternatives for a specific value– Must be at least one item to act as the default value for the
resource The first item being the default if no other is specified Other than rdf:_1, the order of the remaining elements is not
significant. The user can select only one of the values
6
<?xml version="1.0"?><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cd="http://www.recshop.fake/cd#">
<rdf:Description rdf: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>
ContainersContainers as Typed Nodes Can also specify the numbered elements directly or
mix elements
7
<?xml version=“1.0” ?><rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/>
<rdf:Description rdf:about=http://burningbird.net/earthstars/contest.htm> <pstcn:menu> <rdf:Seq> <rdf:_1 rdf:resource=“http://burningbird.net/articles.htm” /> <rdf:li rdf:resource=“http://burningbird.net/dynatech.htm” /> <rdf:li rdf:resource=“http://burningbird.net/interact.htm” /> </rdf:Seq> </pstcn:menu></rdf:Description>
</rdf:RDF>
ContainersContainers Today rdf:li
– used and still documented within the RDF specifications The numbered properties rdf:_1, rdf:_2, etc. are generated from
the li elements in forming the corresponding graph– Its use is discouraged within RDF/XML documents
8
<?xml version=“1.0” ?><rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/>
<rdf:Description rdf:about=http://burningbird.net/earthstars/contest.htm> <pstcn:menu> <rdf:Seq> <rdf:_1 rdf:resource=“http://burningbird.net/articles.htm” /> <rdf:_2 rdf:resource=“http://burningbird.net/dynatech.htm” /> <rdf:_3 rdf:resource=“http://burningbird.net/interact.htm” /> </rdf:Seq> </pstcn:menu></rdf:Description>
</rdf:RDF>
Valid use of containers
9
Outline Containers Collections Reification
Collections (1/2)
rdf:parseType=“Collection”– A finite grouping of items, with a given terminator
– A collection is a list (rdf:List) Each node on the list has an associated predicate of type (List)
as well as the first value in the list, given by the predicate rdf:first
A relationship between the nodes with rdf:rest Terminated with a node, whose value is rdf:nil
10
<?xml version=“1.0” ?><rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# xmlns:pstcn=http://burningbird.net/postcon/elements/1.0/>
<rdf:Description rdf:about=http://burningbird.net/earthstars/contest.htm> <pstcn:menu rdf:parseType=“Collection”> <rdf:Description rdf:resource=“http://burningbird.net/articles.htm” /> <rdf:Description rdf:resource=“http://burningbird.net/dynatech.htm” /> <rdf:Description rdf:resource=“http://burningbird.net/interact.htm” /> </pstcn:menu></rdf:Description>
</rdf:RDF>
Collections (2/2)
11
http://dynamicearth.com/earthstars/contest.htm
http://www.w3.org/1999/02/22-rdf-syntax#nil
http://www.w3.org/1999/02/22-rdf-syntax-ns#List
http://burningbird.net/articles.htm
http://www.w3.org/1999/02/22-rdf-syntax-ns#List
http://burningbird.net/dynatech.htm
http://www.w3.org/1999/02/22-rdf-syntax-ns#List
http://burningbird.net/interact.htm
rdf:type
rdf:type
rdf:type
rdf:first
rdf:first
rdf:first
pstcn:menu
rdf:rest
rdf:rest
rdf:rest
12
Outline Containers Collections Reification
Reification Reification
– A statement is modeled as a resource referenced by another statement
“Jonathon says those cherries are sweet.”
“Jonathon says…,” + “Those cherries are sweet.”
13
Jonathon
says
Those cherries sweetare
ReificationReified Statements (1/3)
The bases of reification in RDF– Model the original statement so that it can be referenced as
the subject of the newer statement
14
<rdf:Description rdf:about="http://www.webreference.com/dhtml/hiermenus/"> <pstcn:Contains>Tutorials and source code about creating hierarchical menus in DHTML</pstcn:Contains> </rdf:Description>
It is missing one thing: an assertion about who is making the recommendation
To. AliceI recommend you an useful link. http://www.webreference.com/dhtml/hiermenus is a source containing tutorials and source code about creating hierarchical menus in DHTML.……
ReificationReified Statements (2/3)
An example
15
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/" xml:base="http://burningbird.net/">
<rdf:Description rdf:about="#s1"> <rdf:subject rdf:resource="http://www.webreference.com/dhtml/hiermenus" /> <rdf:predicate rdf:resource="http://burningbird.net/schema/Contains" /> <rdf:object>Tutorials and source code about creating hierarchical menus in DHTML</rdf:object> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" /> </rdf:Description>
<rdf:Description rdf:about="http://burningbird.net/person/001"> <pstcn:recommends rdf:resource="#s1" /> </rdf:Description>
</rdf:RDF>
ReificationReified Statements (3/3)
Subject: contains the identifier for the resource referenced within the statement Predicate: contains the property that forms the original context of the resource
(the property) Object: contains the value of the property that forms the original context of the
resource (the value) Type: contains the type of the resource
16
http://burningbird.net/
person/001 Tutorials and source code about creating hierarchical
menus in DHTML
http://burningbird.net/
#s1
http://www.webreference.com/dhtml/heirmenus
http://burningbird.net/schema/Contains
http://www.w3.org/1999/02/22-rdf-syntax-ns#List
http://burningbird.net/postcon/elements/1.0/recommends
http://www.w3.org/1999/02/22-rdf-syntax-ns#subject
http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate
http://www.w3.org/1999/02/22-rdf-syntax-ns#object
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
ReificationThe Necessity of Reification and Metastatements (1/2)
Why is reification necessary?– One could model the example in serialized RDF syntax and
not lose the information about who recommends the re-source
“Shelley Powers recommends…,” is not the actual web re-source
Web resource is actually an ancillary component of the rec-ommendation
17
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/">
<rdf:Description rdf:about="http://www.webreference.com/dhtml/hiermenus/"> <pstcn:Contains>Tuturials and source code about creating hierarchichal menus in DHTML</pstcn:Contains> <pstcn:recommendedBy>Shelley Powers</pstcn:recommendedBy> </rdf:Description>
</rdf:RDF>
ReificationThe Necessity of Reification and Metastatements (2/2)
By being able to model the statement about the web resource– you can treat it as a property of another statement– You can be able to distinguish without confusion and without
ambiguity what “fact” you’re describing in an RDF statement
The importance of the distinction between the thing described and the object making the description is both the key and the confusion of reification
18
recommend
The thing described The object making the description
ReificationA Shorthand Reification Syntax (1/5)
A shorthand technique is particularly helpful in cir-cumstances other than just wanting a cleaner syntax
19
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/">
<!--The statement--> <rdf:Description rdf:about="http://www.webreference.com/dhtml/hiermenus"> <pstcn:Contains rdf:ID='s1'> Tutorials and source code about creating hierarchical menus in DHTML</pstcn:Contains> </rdf:Description>
<!--The statement about the statement--> <rdf:Description rdf:about="http://burningbird.net/person/001"> <pstcn:recommendedBy rdf:resource="#s1" /> </rdf:Description>
</rdf:RDF>
ReificationA Shorthand Reification Syntax (2/5)
Recommend what – the web site or the author?
– Shelley Power recommends http://www.webreference.com/dhtml/ahiermenus, as a source of tutorials and source code for hierarchical menus cre-ated in DHTML
– Shelley Power recommends http://www.webreference.com/dhtml/ahiermenus, which is written by Peter Belesis
20
Shelley Power recommends http://www.webreference.com/dhtml/ahiermenus, written by Peter Belesis, as a source of tutorials and source code for hierarchical menus created in DHTML
ReificationA Shorthand Reification Syntax (3/5)
21
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/">
<rdf:Description> <rdf:subject rdf:resource="http://www.webreference.com/dhtml/hiermenus" />
<rdf:predicate rdf:resource="http://burningbird.net/schema/Contains" /> <rdf:object>Tutorials and source code about creating hierarchical menus in DHTML</rdf:object>
<rdf:predicate rdf:resource="http://burningbird.net/schema/WrittenBy" /> <rdf:object>Peter Belesis</rdf:object> <rdf:type rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement" />
<pstcn:recommendedBy>Shelley Powers</pstcn:recommendedBy> </rdf:Description>
</rdf:RDF>
<rdf:Description rdf:about=“http://www.webreference.com/dhtml/hiermenus/”> <pstcn:Contains>Tutorials and source code about creating hierarchical menus in DHTML</pstcn:Contains> <pstcn:writtenBy>Peter Belesis</pstcn:writtenBy></rdf:Description>
ReificationA Shorthand Reification Syntax (4/5)
An rdf:Bag acts as a container for all statements about a specific resource– rdf:bagID is used to identify the implicit Bag
22
<?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:pstcn="http://burningbird.net/postcon/elements/1.0/">
<rdf:Description rdf:about="http://www.webreference.com/dhtml/hiermenus" rdf:bagID="R01"> <pstcn:contains> Tutorials and source code about creating hierarchical menus in DHTML</pstcn:contains> <pstcn:author>Peter Belesis</pstcn:author> </rdf:Description>
<rdf:Description rdf:about="http://burningbird.net/person/001"> <pstcn:recommendeds rdf:resource="#R01" /> </rdf:Description>
</rdf:RDF>
ReificationA Shorthand Reification Syntax (5/5)
23
http://burningbird.net/
person/001Tutorials and source code about creating hierarchical menus in DHTML
http://unknown.org/
#R01
http://www.webreference.com/dhtml/heirmenus
http://burningbird.net/postcon/elements/1.0/contains
http://burningbird.net/postcon/elements/1.0/recommends
http://www.w3.org/1999/02/22-rdf-syntax-ns#subject
http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate
http://www.w3.org/1999/02/22-rdf-syntax-ns#object
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
genid:ARP10834
http://www.w3.org/1999/02/22-rdf-syntzx-ns#Bag
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.burningbird.net/postcon/elements/1.0/
author
Peter Belesis
Peter Belesis
genid:ARP10833
http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement
Tutorials and source code about creating hierarchical menus in DHTML
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.w3.org/1999/02/22-rdf-syntax-ns#subject
http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate
http://www.w3.org/1999/02/22-rdf-syntax-ns#object
http://burningbird.net/postcon/elements/1.0/contains
http://burningbird.net/postcon/elements/1.0/author
http://www.w3.org/1999/02/22-rdf-syntax-ns#_2
http://www.w3.org/1999/02/22-rdf-syntax-ns#_1