ClassIsTypeProperty
The Class of a Node is its rdf:type Property
When you read RDF- say, a FOAF file, the RdfXmlSyntax code looks like...
<foaf:Person> <foaf:name>Your Name Here</foaf:name> <foaf:nick>YourNick</foaf:nick> ... </foaf:Person>
The outermost foaf:Person
is called the class of the node produced.
That is, there is a node produced, and it's "class" is foaf:Person
.
But we know that RDF is all about graphs of nodes, and there are only subject, predicate, and object (SubjectPredicateObject.)
- subjects: (nodes)
- predicates: (paths from subjects to objects)
- objects: (nodes, or literals)
Where then is the notion of a "Class?"
The answer is that it is actually a property (aka "predicate.")
That is, when you say:
<foaf:Person> ... </foaf:Person>
...then you are actually saying: "There is a node, and an RdfStatement attached to this node, automatically."
That statement is:
(node) rdf:type foaf:Person
Discussion
CharlesNepote asks a good question on his page:
Is...
<Prohibition rdf:about="http://web.resource.org/cc/CommercialUse"> <dc:title>Commercial Use</dc:title> <dc:description>rights may be exercised for commercial purposes</dc:description> </Prohibition>
...the same as...
<cc:CommercialUse> <rdf:type rdf:resource="cc:Prohibition"> <dc:title>Commercial Use</dc:title> <dc:description>rights may be exercised for commercial purposes</dc:description> </cc:CommercialUse>
...?
I would think not, because cc:[[CommercialUse]]
would seem to be itself interpreted as a Class here.
I have additional questions:
- Is it possible for a node to belong to two classes?
- How do you make a class-less node? Or is that even possible?
-- LionKimbro DateTime(2004-06-14T02:22:08)
As far as RDF is concerned, rdf:type is no different from any other property, so a given resource can have any number of values for rdf:type
. The RdfXmlSyntax has some shortcuts for declaring rdf:type
, which is probably what is confusing people.
This:
<rdf:Description rdf:about='http://example.com/thing'> <rdf:type rdf:resource='http://vocab.example.com/Thing'/> <dc:title>Example thing</dc:title> </rdf:Description>
can be abbreviated as:
<rdf:Description rdf:about='http://example.com/thing' rdf:type='http://vocab.example.com/Thing'> <dc:title>Example thing</dc:title> </rdf:Description>
or:
<ex:Thing rdf:about='http://example.com/thing' xmlns:ex='http://vocab.example.com/'> <dc:title>Example thing</dc:title> </ex:Thing>
All three will produce the same graph:
<http://example.com/thing> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://vocab.example.com/Thing>. <http://example.com/thing> <http://purl.org/dc/elements/1.1/title> "Example thing".
Using the RdfXmlSyntax, one can use rdf:Description
to describe a resource without specifying its type. To give a resource multiple types, you can declare the rdf:type
properties explicitly or use use the abbreviated form multiple times:
<Class1 rdf:about='http://example.com/whatever'> <rdf:type resource='http://vocab.example.com/Class2'/> <rdf:type resource='http://vocab.example.com/Class3'/> </Class1>
or:
<Class1 rdf:about='http://example.com/whatever'/> <Class2 rdf:about='http://example.com/whatever'/> <Class3 rdf:about='http://example.com/whatever'/>
-- David Menendez DateTime