Question

I want to model an RDF/XML statement about a publication (in namespace, say, 'myns'). I know that this publication is known under a given URN. What is the propper way to reference that URN in RDF? I can think of a number of different ways to do this, e.g.:

<myns:Publication rdf:about="item42">
    <myns:urn>urn:abc:xy:123-456789</myns:urn>
</myns:Publication>

<myns:Publication rdf:about="item42">
    <rdfs:seeAlso>urn:abc:xy:123-456789</rdfs:seeAlso>
</myns:Publication>

<myns:Publication rdf:about="item42">
    <owl:sameAs>urn:abc:xy:123-456789</owl:sameAs>
</myns:Publication>

<myns:Publication rdf:about="item42">
    <owl:sameAs rdf:reference="urn:abc:xy:123-456789" />
</myns:Publication>

What is the right (i.e., the most beneficial) way of giving an URN reference?

Was it helpful?

Solution

First, you'll want to reference the RDF/XML spec, but generally what you're looking for is the rdf:resource attribute, eg:

<owl:sameAs rdf:resource="urn:abc:xy:123-456789"/>

However, you should never be creating RDF/XML by hand. Every toolkit I'm aware of provides some sort of object representation of an RDF Graph and serializers for the various RDF formats which handle these sort of things for you.

I'd guess you're using Java, in which case you should look at either Jena or Sesame when writing your application. If you're using .Net, then you should look at dotNetRdf. Other languages are probably a mixed bag, I know libraries exist of Python & PHP, but I don't use them enough to have a good suggestion on what to use.

Lastly, don't use RDF/XML unless you have a requirement for using an XML-based serialization of RDF. It's ugly and hard to read, and if you're stuck doing it by hand, as you appear to be, it's easy to get wrong. My suggestion is to use Turtle which is a far more human friendly RDF serialization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top