RDF correct approach to subClassOf
What's the difference between these 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#">
<rdf:Description rdf:about="http://www.blah.com/turismo#plaza">
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
</rdf:Description>
<rdf:Description rdf:about="http://www.blah.com/turismo#plazaSinFuente">
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Class"/>
<rdfs:subClassOf rdf:resource="http://www.blah.com/turismo#plaza"/>
</rdf:Description>
b)
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns开发者_JAVA技巧#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:tur="http://www.blah.com/turismo#">
<rdfs:Class rdf:ID="plaza"/>
<rdfs:Class rdf:ID="plazaSinFuente">
<rdfs:subClassOf rdf:resource="#plaza"/>
</rdfs:Class>
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.
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.
精彩评论