tags:

views:

82

answers:

2

I am learning RDF. What's the difference between this two approaches:

a)

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:tur="http://www.blah.com/turismo#"&gt;

<rdf:Description rdf:about="http://www.blah.com/turismo#plaza"&gt;
    <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/&gt;
</rdf:Description>

<rdf:Description rdf:about="http://www.blah.com/turismo#plazaSinFuente"&gt;
    <rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/&gt;
    <rdfs:subClassOf rdf:resource="http://www.blah.com/turismo#plaza"/&gt;
</rdf:Description>

b)

<rdf:RDF
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
   xmlns:tur="http://www.blah.com/turismo#"&gt;

    <rdfs:Class rdf:ID="plaza"/>

<rdfs:Class rdf:ID="plazaSinFuente">
        <rdfs:subClassOf rdf:resource="#plaza"/>
    </rdfs:Class>
+1  A: 

Here you have a nice comparison: http://www.ibm.com/developerworks/xml/library/x-tiprdfai.html

Quote from the conclusion:

As for choosing between rdf:ID and rdf:about, you will most likely want to use the former if you are describing a resource that doesn't really have a meaningful location outside the RDF file that describes it. Perhaps it is a local or convenience record, or even a proxy for an abstraction or real-world object (although I recommend you take great care describing such things in RDF as it leads to all sorts of metaphysical confusion; I have a practice of only using RDF to describe records that are meaningful to a computer). rdf:about is usually the way to go when you are referring to a resource with a globally well-known identifier or location.

mgv
+1  A: 

In the example there is also another difference beside rdf:ID and rdf:about. If you use rdf:Description then you provide the description of a general resource and maybe provide a separate type statement.

If the container element is different like rdfs:Class in the second example, then you provide also type information.

The encoded information is the same, but the second encoding is more concise and readable.

Also you should probably start the Class localName with a capital letter : Plaza and PlazaSinFuente.

Timo Westkämper