Re: RDF friendly XML

Jan Algermissen wrote:
> 
> I am looking for material on making XML RDF friendly. Can anybody 
> help me with a few pointers?
> 
> I know the one by Bob DuCharme and John Cowan already, but is there 
> anything more detailed?

It can be fairly simple for a wide range of xml.  However, as we have 
pointed out in previous threads, it is not likely to happen fully 
automatically.

Start from the element of interest, which is probably the document 
element.  Then that is a resource that acts as a subject.  The rdf:type 
of that resource is given by its {namespace}name.

The immediate children of the root are either considered to be 
predicates (properties), or subjects.  You have to figure that out for 
each case, and it is not always obvious.  If a child is a predicate, 
then it can be left as is for rdf purposes.  If it is supposed to be 
subject (i.e., it has child elements that make statements about it), 
then you need to add an rdf:parseType='Resource' attribute to it.  This 
causes a strategic bnode to be added.

Continue this breakdown recursively.  Sometimes you have to add an 
rdf:resource='...' attribute to an element, usually not.  Attributes 
will usually turn into predicates.

This approach will probably take care of the majority of most common 
xml.  If order of child elements is important (and often it is not), you 
have to add an rdf:parseType='Collection' (if I am remembering the 
syntax correctly) at various points.

I have found that this approach is simple, and lets you use "ordinary" 
xml as rdf with minimal changes.  In turn, this means you can create a 
schema or dtd for the xml format, which can be useful.

Basically, this method is the "striped" method, except where proper 
striping is not present, you fix it by adding parseType='Resource', or 
parseType='Collection'.  In some -maybe many - cases, a predicate is 
simply implied but not actually present, and the parseType='Resource' is 
a way to work around that without having to actually add new layers to 
the original xml.

Cheers,

Tom P

-- 
Thomas B. Passin
Explorer's Guide to the Semantic Web (Manning Books)
http://www.manning.com/catalog/view.php?book=passin

Received on Tuesday, 5 October 2004 03:07:12 UTC