RDF Containers In N3, we could say that Ed (with id 21) and Bill (with id 34) created a certain document as @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax- ns#> . @prefix exstaff: <http://www.example.org/staffid/> . [ a foaf:Document; dc:creator exstaff:21, exstaff:34 ] . But might want to emphasize that they worked as a group It was actually this group that created the document
62
Embed
RDF Containers In N3, we could say that Ed (with id 21) and Bill (with id 34) created a certain document as @prefix foaf:. @prefix dc:. @prefix rdf:. @prefix.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
RDF Containers In N3, we could say that Ed (with id 21) and Bill (with id 34) created a
But might want to emphasize that they worked as a group
It was actually this group that created the document
RDF provides a container vocabulary consisting of
3 predefined types and
some predefined properties
A container is a resource that contains things
The contained things are members
They’re resources (including blank nodes) or literals
Three types of containers:
rdf:Bag
rdf:Seq
rdf:Alt
A Bag (resource having type rdf:Bag) is a group of resources or literals
May have duplicate members
No significance to the order of the members
A Sequence or Seq ( resource having type rdf:Seq) is a group of resources or literals
May have duplicate members
Order of the members is significant
An Alternative or Alt (a resource having type rdf:Alt) is a group of resources or literals that are alternatives
Typically alternatives for a single value of a property
An application using a property whose value is an Alt should be aware that it can choose any 1 of the members
To show that a resource is of a container type, give it an rdf:type property whose value is one of the predefined resources rdf:Bag, rdf:Seq, or rdf:Alt
The container resource (usually a blank node but possibly a resource with a URIref) denotes the group as a whole
A member is described by defining a container membership property
The container resource is its subject
The member is its object
These membership properties have names of the form rdf:_n,
where n is a decimal integer > 0, with no leading 0’s
E.g., rdf:_1, rdf:_2, rdf:_3, …
Container resources may have other properties besides the container membership properties and the rdf:type property
Express in N3 that Ed and Bill (as a group) created a certain document Recall that, in N3, can abbreviate rdf:type as a
An Alt container is intended to have at least 1 member, identified by property rdf:_1
Considered the default or preferred value
The order of the remaining elements isn’t significant
Alt containers are often used in conjunction with language tagging
Alternative versions of a work in different languages
RDF/XML permits the use of the XML xml:lang attribute Indicates that the element content is in a specified
language
As written, the above states simply that the value of the s:DistributionSite site property is the Alt container resource itself
Any additional meaning must be built into
an application's understanding of the intended meaning of an Alt container or
the meaning defined for the particular property (s:DistributionSite in this case) and understood by the application
An application’s understanding of the intended meaning includes, e.g., that
1 of the members of the Alt container is to be considered as the value of the s:DistributionSite site property
There are ways to describe groups of resources that don’t use the RDF container vocabulary
RDF containers are merely provided as common definitions
Sometimes there are clear alternatives to using these RDF container types
E.g., a relationship between a particular resource and a group of other resources could be indicated by making the 1st the subject of multiple statements using the same property See the original example with a bnode for a document as
subject of multiple statements with the dc:creator property
Contrast this with, e.g., the following, where it’s the group that’s the agent
The resolution was approved by the Rules Committee, having members Fred, Wilma, and Dino.
RDF imposes no "well-formedness" conditions on the use of the container vocabulary
So RDF applications that require containers to be "well-formed" should be written to check that the container vocabulary is used appropriately
RDF Collections There’s no way to close a container, i.e., to say "these are all the
members of the container"
And, given a graph that describes some members, there’s no way to rule out another graph somewhere describing additional members
RDF collections support describing groups containing only the specified members
A collection is a group of things represented as a list structure in the RDF graph
This list structure is constructed using a predefined collection vocabulary consisting of the predefined type rdf:List, the predefined properties rdf:first and rdf:rest, and the predefined resource rdf:nil
Consider the statement
The Handbook’s creators are Bill, Ed, and Ken.
Assume Bill is identified by URI “http://www.example.org/staffid/21”
Ed and Ken have similar IDs but with 34 and 46 in place of 21
The “/” in the last rest field represents the nil resource
Each bnode is implicitly of type rdf:List
i.e., implicitly has an rdf:type property whose value is the predefined type rdf:List
Not explicitly shown in the graph
The RDF Schema language defines properties rdf:first and rdf:rest as having subjects of type rdf:List So the info that these nodes are lists can be inferred
One direct translation into RDF/XML represents the bnodes as nested, anonymous rdf:Description elements
The conventional use of the RDF reification vocabulary always involves describing a statement using 4 statements in this pattern—a "reification quad"
Reification isn’t the same as quotation
The reification describes the relationship between
a particular instance of a triple and
the resources the triple refers to
The reification says "this RDF triple talks about these things"
Quotation, in contrast, provides a piece of language use that we can talk about
E.g., we can refer to its grammatical structure or the denotations of its noun phrases
Quotation by itself doesn’t do this “talking about”
Using reification according to this convention, example.com could record the fact that John Smith made the original statement about the tent's weight by
assigning the original statement a URIref, say, exproducts:triple12345,
describing that statement using the reification just described, and
adding an additional statement that exproducts:triple12345 was written by John Smith Need a URIref to identify the John Smith in question
The subject of these reification triples is a URIref formed by concatenating
the base URI of the document (see the xml:base declaration),
the character "#" (introducing a fragment identifier), and
the value of the rdf:ID attribute
So triples have the same subject (exproducts:triple12345) as before
Asserting the reification isn’t the same as asserting the original statement
Neither implies the other
When I say that John said something about the weight of a tent, I’m not making a statement about the weight of a tent itself Rather, I’m making a statement about something John said
Conversely, when I describe the weight of a tent, I’m not also making a statement about a statement someone made
Applications that successfully use reification do so by
following conventions and
making assumptions
that go beyond the meaning that RDF defines for the reification vocabulary
In the conventional use of reification, the subject of the reification triples is assumed to identify a particular instance of a triple in a particular RDF document
This because reification is intended for expressing properties such as dates of composition and source information There could be several instances with the same triple
structure in different documents But these properties need to be applied to specific
instances of triples
We need some way to associate the subject of the reification triples with an individual triple in some document RDF itself provides no way to do this We need a convention among users
E.g., in the above examples, there’s no explicit info that actually indicates that the original statement describing the tent's weight is the resource exproducts:triple12345
This is the resource that’s the subject of the 4 reification statements and the statement that John Smith created it
See the RDF graph above
The original statement is part of this graph
But exproducts:triple12345 labels a separate resource node It doesn’t identify a separate part of the graph (e.g., 2 nodes
and an arc connecting them)
RDF doesn’t provide a built-in way to indicate how a URIref like exproducts:triple12345 is associated with a particular statement or graph
Similarly, there’s no built-in way of indicating how a URIref like exproducts:item10245 is associated with an actual tent
Associating specific URIrefs with specific resources (here statements) must be done outside of RDF
E.g., suppose an RDF document (say, a Web page) has a URI
Statements can be made about the resource identified by that URI
Based on some application-dependent understanding of how to interpret those statements,
an application could act as if those statements apply equally to all statements in the document
More on Structured Values: rdf:value RDF directly supports only binary relations, i.e., statements of
relations between 2 resources
E.g.,
exstaff:85740 exterms:manager exstaff:62345 .
states that the relation exterms:manager holds between 2 employees
But sometimes we must represent info involving relations between more than 2 resources
Earlier discussed the relationship between John Smith and his address info
A 5-ary relation of the form:
address(exstaff:85740, "1501 Grant Avenue", "Bedford", "Massachusetts", "01730")
Can be represented in RDF by
considering the aggregate thing described (here the group of address components) as a separate resource
then making separate statements about that new resource
exstaff:85740 exterms:address _:johnaddress .
_:johnaddress exterms:street "1501 Grant Avenue" .
_:johnaddress exterms:city "Bedford" .
_:johnaddress exterms:state "Massachusetts" .
_:johnaddress exterms:postalCode "01730" .
A general way to represent any n-ary relation in RDF
Select 1 of the participants (here John) as the subject of the original relation (here address)
Then specify an intermediate resource (usually a bnode) to represent the rest of the relation
Then give that new resource properties representing the remaining components of the relation
For the address, none of the parts is the "main" value of the exterms:address property
But sometimes 1 part of a structured value is the "main" value
E.g., in an earlier example, the weight of a certain tent was given as 2.4 using a typed literal
This also illustrates a previous use of the rdf:parseType attribute:
rdf:parseType="Resource"
Indicates that the contents of an element are to be interpreted as the description of a new bnode resource
without actually writing a nested rdf:Description element
Here the rdf:parseType="Resource" attribute in the exterms:weight property element indicates
a bnode as the value of the exterms:weight property and
that the enclosed elements (rdf:value and exterms:units) describe properties of that bnode
The approach illustrated 2 slides back can be used to represent
quantities using any units of measure and
values taken from different classification schemes or rating systems
Use the rdf:value property to give the main value
Use additional properties to identify the classification scheme or other info further describing the value
The correct interpretation of data in the Web environment may require that additional info (such as units) be explicitly recorded
There are alternatives to rdf:value (e.g., a user-defined property such as exterms:amount)
RDF doesn’t associate any special meaning with rdf:value
A convenience for use in these commonly-occurring situations
XML Literals Sometimes the value of a property needs to be a fragment of XML
E.g., a publisher might maintain RDF metadata that includes titles represented with XML elements and attributes
To facilitate writing XML literals, RDF/XML provides a 3rd value of the rdf:parseType attribute
Given an element, the attribute
rdf:parseType="Literal"
indicates that the contents of the element are to be interpreted as an XML fragment
Using rdf:parseType="Literal", an RDF user avoids dealing directly the various transformations required for representing XML fragments in the accepted (“canonical”) way—e.g.,