XPath-ing an RDF Profile
I’ve been working on some stuff for the OpenDocument metadata group, including an RDF profile amenable to XML processing, simply to show what might be possible. I was working on an XSLT to demonstrate how it could be processed using standard XML tools, and also how I might model the constraints in Schematron (having already figured it out in RELAX NG), so naturally had to figure out how to write generic xpaths for basic structures like resources, properties, and so forth.
Here’s what I came up with as a start …
All resources:
//[ and not(preceding-sibling::/text()) and not(parent::/@rdf:about)]
Am not too fond of this one, but it works with my example documents.
All properties:
//[not()]
That’s more like it!
Would need more work to come up with a robust, generic, RDF profile validator using only xpath (e.g. Schematron), but it seems not too hard. In any case, it’s certainly easier that writing a generic XML metadata validator!
Creative Commons License
There was an interesting paper about this problem at Extreme Markup Languages 2006, “RxPath: a mapping of RDF to the XPath Data Model”.