Search code examples
javardfjenaowlreasoning

Jena infers rdfs:Resource to be in range of a owl:DatatypeProperty. Why?


If I have any property with some XMLSchema data type in its rdfs:range, the Jena reasoner (OWL_MEM_RULE_INF spec in my case) automatically adds rdfs:Resource to that range. Why is that? Doesn't that mean I can use literally anything as a value of that property?

For example:

<rdf:RDF xmlns="http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl#"
    xml:base="http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:ds="http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl#">

<owl:DatatypeProperty rdf:about="&ds;date">
    <rdfs:label>date</rdfs:label>
    <rdfs:label xml:lang="en">date</rdfs:label>
    <rdfs:range rdf:resource="&xsd;dateTime"/>
</owl:DatatypeProperty>

</rdf:RDF>

Query:

PREFIX ds:   <http://mre.kiv.zcu.cz/ontology/2013/01/dasta.owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?r
WHERE
{
    ds:date rdfs:range ?r
}

Output:

---------------------------------------------------
| r                                               |
===================================================
| <http://www.w3.org/2001/XMLSchema#dateTime>     |
| <http://www.w3.org/2000/01/rdf-schema#Resource> |
---------------------------------------------------

Solution

  • Okay, I've found out I had been misunderstanding the whole rdfs:range and rdfs:domain concept.

    ---------------------------------------------------
    | r                                               |
    ===================================================
    | <http://www.w3.org/2001/XMLSchema#dateTime>     |
    | <http://www.w3.org/2000/01/rdf-schema#Resource> |
    ---------------------------------------------------
    

    This result doesn't mean I can use anything "as a value" of the property. It means the value would be of type dateTime AND Resource -- both at once. Range of a property is meant to be an intersection (not union) of types mentioned in its rdfs:range.