Am I supposed to be able to use a namespace prefix when referring to a subject with the "rdf:about" attribute in RDF/XML, like so:
I can't find any such example on the net, and the RDF library I'm using (ARC2) doesn't seem to support it, so I wanted to make clear whether it is supposed to work or not according to standards.
asked 10 Jul '10, 21:55
No you can't: According to the Relax NG the rdf:about statement requires an URI reference:
A RDF URI reference is defined as follows:
answered 10 Jul '10, 22:12
No you can't. This is one of the many reasons why Turtle is so much better than RDF/XML.
answered 11 Jul '10, 00:59
It seems like it does not work in practice, either. Given the xml input
The W3C's validator doesn't complain, but produces a triple with the subject prefix not expanded.
myns:someEntity http://example.org/someBaseURI#someProperty "foo" .
Running it through cwm produces similar results.
~> cwm --rdf test.xml --ntriples <myns:someEntity> <http://example.org/someBaseURI#someProperty> "foo" .
answered 11 Jul '10, 00:53
As others have said, no you can't. You can, however, define the prefix as an XML entity at the head of the file, so that you only have one place to keep prefixes up-to-date. The principle problem with this approach (other than the ugly XML entity syntax) is that few, if any, RDF tools that I can think of will preserve XML entity declarations between reading and subsequent writing. So it works OK on files that you directly edit yourself in a text editor or XML editor, but not otherwise.
Having said that, I'd agree with Richard that using Turtle as your input syntax is a better idea. If you need XML as part of your toolchain, there are tools that can convert Turtle to XML.
answered 11 Jul '10, 14:36
No. You can't use a namespace prefix in an rdf:about attribute.
The specification explains that the rdf:about attribute is a URI Reference:
From an XML perspective there are a number of issues with allowing the use of QNames in Content. See this tag finding for discussion:
Other RDF serializations do allow prefixed names as e.g. CURIE's:
answered 12 Jul '10, 11:24