rdfowlontologyrdfsfoaf

RDFS: How to subclass a FOAF class


Is it possible to subclass a class found in FOAF (http://xmlns.com/foaf/spec/)? I tried something like the code below, but I am not sure if it is the proper way to do it or not.

<rdfs:Class rdf:ID="user"> 
    <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/#Agent" />
    <rdfs:comment> 
        The class of users, subclass of foaf:Agent.
    </rdfs:comment>  
</rdfs:Class>

Solution

  • Your snippet, although not a complete RDF document, is the right way to make yourdoc#user a subclass of http://xmlns.com/foaf/0.1/#Agent. However, that latter class is not the FOAF Agent class. The FOAF Agent class is identified by the URI http://xmlns.com/foaf/0.1/Agent (with no #). It might be useful to have a look at the actual FOAF ontology, because you can see how it defines subclasses of Agent. For instance, it declared foaf:Organization with

    <rdfs:Class rdf:about="http://xmlns.com/foaf/0.1/Organization" rdfs:label="Organization" rdfs:comment="An organization." vs:term_status="stable">
      <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/>
      <rdfs:subClassOf rdf:resource="http://xmlns.com/foaf/0.1/Agent"/>
      <rdfs:isDefinedBy rdf:resource="http://xmlns.com/foaf/0.1/"/>
      <owl:disjointWith rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
      <owl:disjointWith rdf:resource="http://xmlns.com/foaf/0.1/Document"/>
    </rdfs:Class>
    

    If you're writing this by hand, it's much easier to work in the Turtle or N3 serialization, where that would be:

    foaf:Organization  a      rdfs:Class , owl:Class ;
            rdfs:comment      "An organization." ;
            rdfs:isDefinedBy  foaf: ;
            rdfs:label        "Organization" ;
            rdfs:subClassOf   foaf:Agent ;
            owl:disjointWith  foaf:Person , foaf:Document ;
            vs:term_status    "stable" .