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:

<rdf:RDF xmlns:myns="">
<rdf:Description rdf:about="myns:someEntity">

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

Samuel%20Lampa's gravatar image

Samuel Lampa
accept rate: 33%

Thanks for all the helpful answers!

(12 Jul '10, 13:10) Samuel Lampa Samuel%20Lampa's gravatar image

No you can't: According to the Relax NG the rdf:about statement requires an URI reference:

aboutAttr = 
  attribute rdf:about { 

A RDF URI reference is defined as follows:

6.4 RDF URI References

A URI reference within an RDF graph (an RDF URI reference) is a Unicode string that:

• does not contain any control characters ( #x00 - #x1F, #x7F-#x9F)
• and would produce a valid URI character sequence (per RFC2396 [URI], sections 2.1) representing an absolute URI with optional fragment identifier when subjected to the encoding described below.

permanent link

answered 10 Jul '10, 22:12

Markus%20Lanthaler's gravatar image

Markus Lanth...
accept rate: 50%

No you can't. This is one of the many reasons why Turtle is so much better than RDF/XML.

permanent link

answered 11 Jul '10, 00:59

cygri's gravatar image

cygri ♦
accept rate: 34%

It seems like it does not work in practice, either. Given the xml input

  <?xml version="1.0"?>
<rdf:RDF xmlns:rdf=""
<rdf:Description rdf:about="myns:someEntity">

The W3C's validator doesn't complain, but produces a triple with the subject prefix not expanded.

  myns:someEntity "foo" .

Running it through cwm produces similar results.

  ~> cwm --rdf test.xml --ntriples
  <myns:someEntity> <> "foo" .
permanent link

answered 11 Jul '10, 00:53

Tim%20Finin's gravatar image

Tim Finin
accept rate: 25%

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.

permanent link

answered 11 Jul '10, 14:36

Ian's gravatar image

accept rate: 0%

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:

permanent link

answered 12 Jul '10, 11:24

ldodds's gravatar image

accept rate: 32%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 10 Jul '10, 21:55

question was seen: 5,959 times

last updated: 12 Jul '10, 11:24