[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RDF/XML and XPath
Svante, I'll go through as many problems as I can point out with thinking that XPath is feasible with just a few variations on the RDF/XML serializations of an RDF model. During the call I heard you mentioned "walking up the tree" looking for the top most @rdf:about. I just want to point out how that itself wouldn't work using examples from the RDF/XML specification. I'm going to assume that to find out the subject of ex:fullName you'd go up and look for @rdf:about which points to <http://www.w3.org/TR/rdf-syntax-grammar> <?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/" xmlns:ex="http://example.org/stuff/1.0/"> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar" dc:title="RDF/XML Syntax Specification (Revised)"> <ex:editor ex:fullName="Dave Beckett" /> </rdf:Description> </rdf:RDF> In N3: <http://www.w3.org/TR/rdf-syntax-grammar> dc:title "..." ; ex:editor [ ex:fullName "Dave Beckett" . ] . Meaning that ex:fullName "Dave Beckett" is a property on an anonymous node and NOT on the <http://www.w3.org/TR/rdf-syntax-grammar> itself. There's an extra node in the graph w/o a name, so you can't assume the "highest" rdf:about is the one that pertains. RDF/XML is trying to represent a graph, not a tree, like HTML. RDFa takes advantage of the tree properties of HTML to define an extraction mechanism but only of triples than then together will make up a graph. Let's take another variation on the previous one. <?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/" xmlns:ex="http://example.org/stuff/1.0/" xml:base="http://www.w3.org/TR/"> <rdf:Description rdf:about="rdf-syntax-grammar" dc:title="RDF/XML Syntax Specification (Revised)"> <ex:editor ex:fullName="Dave Beckett" /> </rdf:Description> </rdf:RDF> Notice how I've added xml:base to the document. Now your XPath would break because you were matching for the full URI. Another short variation.... <?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/" xmlns:ex="http://example.org/stuff/1.0/" xml:base="http://www.w3.org/"> <rdf:Description xml:base="TR/" rdf:about="rdf-syntax-grammar" dc:title="RDF/XML Syntax Specification (Revised)"> <ex:editor ex:fullName="Dave Beckett" /> </rdf:Description> </rdf:RDF> Notice yet another xml:base declaration in rdf:Description. Remember, all of these serializations generate an isomorphic RDF model. Also note how I have not yet even used RDF/XML vs RDF/ABBREV, completely throwing out the argument of using a "simplified/constrained" RDF/XML serialization. Here's another example that shows the love/hate relationship between XPath and RDF. Notice how ex:fullName property is expressed using an attribute and then in the second version, it's done using an element. <?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/" xmlns:ex="http://example.org/stuff/1.0/"> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar" dc:title="RDF/XML Syntax Specification (Revised)"> <ex:editor> <rdf:Description ex:fullName="Dave Beckett"> <ex:homePage rdf:resource="http://purl.org/net/dajobe/" /> </rdf:Description> </ex:editor> </rdf:Description> </rdf: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/" xmlns:ex="http://example.org/stuff/1.0/"> <rdf:Description rdf:about="http://www.w3.org/TR/rdf-syntax-grammar" dc:title="RDF/XML Syntax Specification (Revised)"> <ex:editor rdf:parseType="Resource"> <ex:fullName>Dave Beckett</ex:fullName> <ex:homePage rdf:resource="http://purl.org/net/dajobe/"/> </ex:editor> </rdf:Description> </rdf:RDF> Here's another one showing a completely different structure. Notice the channel1 and channel2 references. <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://testuri.org#"> <tv-guide> <channels> <rdf:List> <rdf:li> <channel rdf:ID="channel1"/> </rdf:li> <rdf:li> <channel rdf:ID="channel2"/> </rdf:li> </rdf:List> </channels> </tv-guide> </rdf:RDF> <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://testuri.org#"> <tv-guide> <channels> <rdf:List> <rdf:li rdf:resource="#channel1"/> <rdf:li rdf:resource="#channel2"/> </rdf:List> </channels> </tv-guide> <channel rdf:ID="channel1"/> <channel rdf:ID="channel2"/> </rdf:RDF> Here's one showing long and abbreviated format examples: <?xml version="1.0" encoding="iso-8859-1"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.0/"> <rdf:Description rdf:about="http://www.mcgill.ca/libraries-techserv/" dc:title="McGill University Libraries Library Technical Services Home Page" dc:creator="Karen Jensen" dc:subject="..." dc:description="..." dc:publisher="McGill University Libraries. Library Technical Services." dc:contributor="..." dc:date="2003-03-03" dc:type="Text" dc:format="text/html" dc:identifier="http://www.mcgill.ca/libraries-techserv/" dc:language="en"/> </rdf:RDF> and ... not rdf:Description and again everything went from attributes to elements. <rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.0/" xmlns:log="http://www.w3.org/2000/10/swap/log#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <Text xmlns="file:/tmp/" rdf:about="http://www.mcgill.ca/libraries-techserv/"> <dc:contributor>...</dc:contributor> <dc:creator>Karen Jensen</dc:creator> <dc:date>2003-03-03</dc:date> <dc:description>...</dc:description> <dc:format>text/html</dc:format> <dc:identifier>http://www.mcgill.ca/libraries-techserv/</dc:identifier> <dc:language>en</dc:language> <dc:publisher>McGill University Libraries. Library Technical Services.</dc:publisher> <dc:subject>...</dc:subject> <dc:title>McGill University Libraries Library Technical Services Home Page</dc:title> </Text> </rdf:RDF> I hope these examples help you see why using XPath is just not a good idea to link between ODF and RDF/XML serializations of our metadata. -Elias
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]