Search code examples
rdfontology

The puzzling semantics of rdf:type


Although I have created several ontologies and have some expertise, I have been unclear about the semantics of rdf:type for some time. The W3C spec says "rdf:type is an instance of rdf:Property that is used to state that a resource is an instance of a class.

In the following example, the subject mus:12345 is not a vase object itself, but a page describing it.

@prefix voc: <http://somemuseum.com/ontology#> .
@prefix mus: <http://somemuseum.com/artifacts/> .
voc:Vase rdf:type owl:Class .
mus:12345 rdf:type voc:Vase .

It seems to me the semantics of these statements is: "the web page http://somemuseum.com/artifacts/12345 is an object defined by http://somemuseum.com/ontology#Vase"

But it is not the object, it is a web page. Isn't it more precise to say mus:12345 rdf:type voc:VaseDescription, or mus:12345 rdf:type voc:ArtifactDescription?

In this example, the information I would want to convey is: "there is an object of the class Vase, described by the web page http://somemuseum.com/artifacts/12345. And then things like that Vase object is 25cm tall and so on. But does this statement convey that? mus:12345 voc:height "25cm"? After all, mus:12345 is a page not a vase.


Solution

  • In RDF, each thing should get its own IRI. A good practice is to use HTTP(S) IRIs for this.

    The vase (the physical object) would be one thing. A webpage that describes this vase would be another thing (an information resource).

    It’s important to make sure that no webpage exists under the HTTP(S) IRI which should represent a thing which is not an information resource (e.g., a vase).

    If you don’t want to publish a webpage that describes a non-information-resource thing, you don’t have to do anything special, you just need to make sure that the server will never answer with HTTP status code 200 for (exactly) that URL.

    If you do want to publish webpages, there are two conventions for this: Hash IRIs and 303 IRIs.

    Example using Hash IRI

    IRI for the webpage about the vase:

    http://somemuseum.com/artifacts/12345
    

    IRI for the vase:

    http://somemuseum.com/artifacts/12345#this
    

    The fragment identifier could be anything (this, it, vase, …), as long as there is no id/name attribute for it in the HTML document.

    Example using 303 IRI

    IRI for the webpage about the vase:

    http://somemuseum.com/descriptions/12345
    

    When requesting the URL http://somemuseum.com/descriptions/12345, the server responds with status code 200.

    IRI for the vase:

    http://somemuseum.com/artifacts/12345
    

    When requesting the URL http://somemuseum.com/artifacts/12345, the server responds with status code 303, and redirects to the URL http://somemuseum.com/descriptions/12345.

    rdf:type

    In addition, you can (and should) make statements about the two IRIs, and put them in relation.

    The webpage could get the type schema:ItemPage. To connect the two things, you could use the schema:mainEntity property.

    Example using the Slash IRI way:

    @prefix voc: <http://somemuseum.com/ontology#> .
    @prefix mus: <http://somemuseum.com/artifacts/> .
    @prefix mus-page: <http://somemuseum.com/descriptions/> .
    @prefix schema: <http://schema.org/> .
    
    voc:Vase rdf:type owl:Class .
    mus:12345 rdf:type voc:Vase .
    
    mus-page:12345 rdf:type schema:ItemPage .
    
    mus-page:12345 schema:mainEntity mus:12345 .