Outputting All Node Labels
Here's an RDF Template that outputs the labels for all the nodes in the graph:
<rt:stylesheet xmlns:rt="http://purl.org/vocab/2003/rdft/">
<rt:root-template>
<html>
<head>
<title>Output All Node Labels</title>
</head>
<body>
<rt:for-each rt:select="/node()">
<pre>
<rt:value-of rt:select="label()" />
</pre>
</rt:for-each>
</body>
</html>
</rt:root-template>
</rt:stylesheet>
This works well in the bleeding edge version of phpRDFT (not released yet, will be very soon) but demonstrates a potential drawback in the processing model: all the nodes inferred by the RDFS closure rules are also displayed. This wasn't unexpected but might cause confusion for someone getting to grips with RDFT for the first time.
As an example, here's the input RDF:
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<rdf:Description rdf:about="http://1.example.com/">
<dc:creator>Fred Flintstone</dc:creator>
</rdf:Description>
<rdf:Description rdf:about="http://2.example.com/">
<dc:publisher rdf:resource="mailto:publisher@example.com" />
<dc:creator rdf:resource="mailto:webmaster@2.example.com" />
</rdf:Description>
<rdf:Description rdf:about="http://3.example.com/">
<dc:publisher rdf:resource="mailto:publisher@example.com" />
<dc:creator rdf:resource="mailto:webmaster@3.example.com" rdf:value="webmaster"/>
</rdf:Description>
</rdf:RDF>
And the output of the stylesheet above:
<html>
<head>
<title>Output All Node Labels</title>
</head>
<body>
<pre>http://www.w3.org/2000/01/rdf-schema#subPropertyOf</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#Property</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#subClassOf</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#Class</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#domain</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#range</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#subject</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#object</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#first</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#List</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#rest</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#comment</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#Literal</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#label</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#Container</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#ContainerMembershipProperty</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#isDefinedBy</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#seeAlso</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#Datatype</pre>
<pre>http://www.w3.org/2000/01/rdf-schema#Resource</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#nil</pre>
<pre>http://1.example.com/</pre>
<pre>Fred Flintstone</pre>
<pre>http://2.example.com/</pre>
<pre>mailto:publisher@example.com</pre>
<pre>mailto:webmaster@2.example.com</pre>
<pre>http://3.example.com/</pre>
<pre>mailto:webmaster@3.example.com</pre>
<pre>webmaster</pre>
<pre>http://purl.org/dc/elements/1.1/creator</pre>
<pre>http://purl.org/dc/elements/1.1/publisher</pre>
<pre>http://www.w3.org/1999/02/22-rdf-syntax-ns#value</pre>
</body>
</html>
Comments
No comments yet.
Leave a comment
Sorry, the comment form is closed at this time.
