((note: I prefer the exposition I give in
"Re: xml without rdf, but with an ontology" [1], to the one I first
explained on this thread. I here give a concise sumary of that view.))
On 13 Jan 2005, at 11:36, Sean B. Palmer wrote:
> > Perhaps there is a default mapping from xml to triple space
>
> There is no default, because you can't just assume semantics from XML,
> but that doesn't stop you from creating a particular interpretation for
> Atom.
According to Roy Fielding [2] and Tim Bray, xml has a very clear
semantics:
containment semantics. If we only map xml very minimally to our graph
then
I think we get very close to a default mapping of xml into a graph. All
we
are doing is revealing the default xml semantics.
<feed>
<entry>
<title>hello</title>
<id>urn:id:id1</id>
</entry>
</feed>
maps to
_f -feed-> _e
|--title-->_t
| |--xx:text--> "hello"
|--id----->_id
|--xxx:text-> "urn:id:id1"
we are not saying much more here than what is said in the xml.
I hope that is well represented by the graph above.
All xml has named elements and attributes. These may have extra
semantics
defined for them in an OWL file located at the namespace location of the
element or attribute. When these attributes do have such extra
information
associated with them, the graph can then be further, and very usefully
transformed in ways we have expected from rdf.
So the OWL file for the example xml above may have the following
rule
for all Sub and Obj
if Sub --title--> Obj then Obj --is-a-> <xxx:String>
if Sub --id-----> Obj then Obj --is-a-> <xxx:anyUri>
from this our simple graph above can be extended to
_f -feed-> _e
|--title-->_t ==is=a==> <xxx:String>
| |--xx:text--> "hello"
|--id----->_id ==is=a=> <xxx:anyUri>
|--xxx:text-> "urn:id:id1"
I am not sure if the following transformation is legal
in the rdf graph model, but it seems intuitively right
Whenever
Subj ---is-a--> <xxx:String>
|---xxx:text-> "some text"
then
we can replace the above graph with "some text"
The equivalent in java would be that
if you had an Object o and you knew that
+ o.toString().equals("some text")
+ o instanceof String
then you could deduce that o is the String "some text"
We can do the same simplification with
Subj ---is-a--> <xxx:anyUri>
|--xxx:text--> "urn:id:id1"
Then we know that Subj is <urn:id:id1>
with these rules that we can now simplify the graph
we had to
_f -feed-> _e
|--title--> "hello"
|--id-----> <urn:id:id1>
Now assuming the ontology also told us that the "id"
relation is functional, inverse functional, transitive and
symmetric (I think that's the identity property) then the
graph above is equivalent to
_f -feed-> <urn:id:id1>
|--title--> "hello"
Which shows you how you can interpret simple xml (with an ontology)
in such a way as to get a sensible graph for it.
Henry Story
[1] See especially the version of that email archived on the bloged
mailing list
that did the best job at keeping the ascii diagrams intact:
<https://bloged.dev.java.net/servlets/ReadMsg?list=users&msgNo=441>
(I think ascii diagrams and Apple's Mail.app do not good bedfellows
make.)
[2] http://www.imc.org/atom-syntax/mail-archive/msg11988.html
[3] I don't in fact believe that atom:id is an identity property
see http://www.imc.org/atom-syntax/mail-archive/msg12067.html