- From: Phil Dawes <pdawes@users.sourceforge.net>
- Date: Thu, 13 Jan 2005 08:52:21 +0000
- To: Henry Story <henry.story@bblfish.net>
- Cc: www-rdf-interest@w3.org, atom-owl@googlegroups.com
Hi Henry, I've been having similar thoughts recently, although my motivation is being able to translate xml into rdf triples with the minimum of mapping information. I've written a script (to test the idea) that does pretty-much the same translation - if you're interested I'll stick it on the web somewhere when I get to work. N.B. I think it'd also need to handle ordered collections to be generically useful (since xml is implicitly ordered). Cheers, Phil Henry Story writes: > > Tim Bray, Roy Fielding and other have recently made some interesting > comments on the atom list saying that xml's tree structure has an > implicit > semantics. > > This has led me to the following thought. Perhaps there is a default > mapping from xml to triple space that encodes xml such as > > <feed atom:version="draft-ietf-atompub-format-03: do not deploy" > xmlns="http://purl.org/atom/ns#draft-ietf-atompub-format-03"> > <head> > <title>Example Feed</title> > <link href="http://example.org/"/> > <updated>2003-12-13T18:30:02Z</updated> > <author> > <name>John Doe</atom:name> > </author> > </head> > <entry> > <title>Atom-Powered Robots Run Amok</title> > <link href="http://example.org/2003/12/13/atom03"/> > <id>vemmi://example.org/2003/32397</id> > <versionid>vemmi://example.org/2003/32397/v1</versionid> > <updated>2003-12-13T18:30:02Z</updated> > </entry> > </feed> > > this way: > > _f --feed--->_f1 > |---head--->_h1 > | |---title-->"example Feed" > | |---link--->_l1 > | | |--href----> > <http://example.org/> > | |--updated->"2003-12-13T18:30:02Z" > | |--author-->_a1 > | |---name--->"John Doe" > | |---mbox--->"john@doe.com" > |--entry-->_e1 > |--title-->"Atom Powered Robots Run Amok" > |--link--->_l1 > | |--href-----> > <http://example.org/2003/12/13/atom03> > |--id-------> > <vemmi://example.org/2003/12/13/atom03> > |-versionid-> > <vemmi://example.org/2003/12/13/atom03/v1> > |--updated-->"2003-12-13T18:30:02Z" > > > The method of producing the mapping is very simple. Every element has a > blank element > as subject and a blank element as a node, unless the child of the node > is a simple string. > Every attribute on an element is an attribute on the blank node that > that element points to, > and has as object the interpretation of the string required for that > attribute. > > So in the example above the subject of the "head" element is the blank > node > _f1 and the object is the blank node _h1. Take the "link" element > > <link href="http://example.org/"/> > > it has a blank node _h1 as subject and a blank node _l1 as object. The > attribute > atom:href has the blank node _l1 as subject and the interpretation of > "http://example.org" > that it requires as object. > > Good so how do we know what that interpretation is? Well we have to > look to the > ontology of the atom:href attribute. Perhaps we have a file at hand > that gives > us this. This file says the object of href is a resource. So we cast > that to a > resource, and we get what we were asking for above. > > Interestingly enough the triple model I get from parsing the > above xml that way is (nearly) exactly the same as the triple model > I get from parsing the closest rdf/xml I could get that resembles > the xml above: > > <?xml version="1.0" encoding="utf-8"?> > <atom:feed atom:version="draft-ietf-atompub-format-03: do not deploy" > xmlns:atom="http://purl.org/atom/ns#draft-ietf-atompub-format-03" > xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> > <atom:head rdf:parseType="Resource"> > <atom:title>Example Feed</atom:title> > <atom:link atom:href="http://example.org/"/> > <atom:updated>2003-12-13T18:30:02Z</atom:updated> > <atom:author rdf:parseType="Resource"> > <atom:name>John Doe</atom:name> > </atom:author> > </atom:head> > <atom:entry rdf:parseType="Resource"> > <atom:title>Atom-Powered Robots Run Amok</atom:title> > <atom:link atom:href="http://example.org/2003/12/13/atom03"/> > <atom:id>vemmi://example.org/2003/32397</atom:id> > <atom:versionid>vemmi://example.org/2003/32397</atom:versionid> > <atom:updated>2003-12-13T18:30:02Z</atom:updated> > </atom:entry> > </atom:feed> > > So that would tend to indicate that we are close to the intuitions of > the original > developers of rdf/xml. > > Now how do we ever get to fill in the blank nodes that are so > plentifully spread around? > Well again with the help of the ontology, and especially properties > that are both functional, > inverse functional, symmetric and transitive: ie: identity properties. > > So if for example the versionid property were such an identity property > then we could > deduce from the above graph the following graph: > > > _f --feed--->_f1 > |---head--->_h1 > | |---title-->"example Feed" > | |---link--->_l1 > | | |--href----> > <http://example.org/> > | |--updated->"2003-12-13T18:30:02Z" > | |--author-->_a1 > | |---name--->"John Doe" > | |---mbox--->"john@doe.com" > |--entry--> <vemmi://example.org/2003/12/13/atom03/v1> > |--title-->"Atom Powered Robots Run Amok" > |--link--->_l1 > | |--href-----> > <http://example.org/2003/12/13/atom03> > |--id-------> > <vemmi://example.org/2003/12/13/atom03> > |--updated-->"2003-12-13T18:30:02Z" > > > This oddly enough still leaves a problem with xml like the following > > <entry> > <generator > uri="https://bloged.dev.java.net/" > version="0.5">BlogEd</generator> > </entry> > > which is exactly the same type of xml that does not seem to be parsable > in rdf-xml > > perhaps that should be > > _e1 > |------generator---->_g ---rdf:text-->"BlogEd" > |----uri---> <https://bloged.dev.java.net/> > |--version-> "0.5" > > > > > >
Received on Thursday, 13 January 2005 11:56:46 UTC