Search code examples
sparqljenaowlprotegefuseki

Fuseki reasoner doesn't infer data (int) range classes


To show you the problem (which is a bug) I created a minimum example:

This is my minimum ontology

@prefix : <http://www.test.com/ts#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://www.test.com/ts> a owl:Ontology .
# 
# 
# #################################################################
# #
# #    Object Properties
# #
# #################################################################
# 
# 
# http://www.test.com/ts#hasSex

:hasSex a owl:ObjectProperty , owl:FunctionalProperty ;
    rdfs:range :Sex .
# 
# 
# 
# #################################################################
# #
# #    Data properties
# #
# #################################################################
# 
# 
# http://www.test.com/ts#hasAge

:hasAge a owl:DatatypeProperty , owl:FunctionalProperty ;
    rdfs:range xsd:int .
# 
# 
# 
# #################################################################
# #
# #    Classes
# #
# #################################################################
# 
# 
# http://www.test.com/ts#FemaleUser

:FemaleUser a owl:Class ;
    owl:equivalentClass _:genid1 .

_:genid1 owl:intersectionOf _:genid4 .

_:genid4 a rdf:List ;
    rdf:first :User ;
    rdf:rest _:genid2 .

_:genid2 a rdf:List ;
    rdf:first _:genid3 .

_:genid3 a owl:Restriction ;
    owl:onProperty :hasSex ;
    owl:hasValue :female .

_:genid2 rdf:rest rdf:nil .

_:genid1 a owl:Class .
# 
# http://www.test.com/ts#MatureUser

:MatureUser a owl:Class ;
    owl:equivalentClass _:genid5 .

_:genid5 owl:intersectionOf _:genid11 .

_:genid11 a rdf:List ;
    rdf:first :User ;
    rdf:rest _:genid6 .

_:genid6 a rdf:List ;
    rdf:first _:genid7 .

_:genid7 a owl:Restriction ;
    owl:onProperty :hasAge ;
    owl:someValuesFrom _:genid8 .

_:genid8 a rdfs:Datatype ;
    owl:onDatatype xsd:int ;
    owl:withRestrictions _:genid9 .

_:genid9 a rdf:List ;
    rdf:first _:genid10 .

_:genid10 xsd:minInclusive "16"^^xsd:int .

_:genid9 rdf:rest rdf:nil .

_:genid6 rdf:rest rdf:nil .

_:genid5 a owl:Class .
# 
# http://www.test.com/ts#Sex

:Sex a owl:Class .
# 
# http://www.test.com/ts#User

:User a owl:Class .
# 
# 
# 
# #################################################################
# #
# #    Individuals
# #
# #################################################################
# 
# 
# http://www.test.com/ts#ania

:ania a owl:NamedIndividual , :User ;
    :hasSex :female ;
    :hasAge "18"^^xsd:int .
# 
# http://www.test.com/ts#female

:female a owl:NamedIndividual , :Sex .
# 
# http://www.test.com/ts#male

:male a owl:NamedIndividual , :Sex .
# 
# Generated by the OWL API (version 4.1.3.20151118-2017) https://github.com/owlcs/owlapi

There are two classes:

one MatureUser (for user that hasAge more than 16 years) and FemaleUser (for user that hasSex as female)

Screenshot from protege:

enter image description here

You can see that protege infers that :ania is both female and mature user, However, fuseki just infer that :ania is female but not mature

enter image description here

Update

I also tried to make my equivelent class in these two forms

User and hasAge some xsd:int[>="16"^^xsd:int]

and

User and hasAge some xsd:int[>=16]

but the same result, which is Protege infers correctly, while furseki not.


Solution

  • The OWL reasoners supplied with Jena are not logically complete; that means that (by design) there are OWL inferences that they won't infer. The OWL reasoners that are available in Protege should be logically complete; that means that they should produce all the entailed axioms.

    In this case, Jena's OWL reasoners simply don't do datatype reasoning. That means that they won't really do anything with the xsd:int[>= 16] type. In this case, it's not just a matter of Jena's OWL reasoners not being complete, it's also that Jena's OWL reasoners are aimed at OWL 1, but datatype facet reasoning is part of OWL 2, which Jena doesn't completely support. E.g., see this thread about datatype restrictions from 2013 in the Jena users mailing list. Dave Reynolds replies to an inquiry similar to yours:

    Datatype facets are OWL 2 and Jena only supports OWL 1.

    It may be possible to use third party reasoners like Pellet to provide some OWL 2 capability.

    Jena's non-support of OWL2 is mentioned explicitly in the documentation. There's an OWL2 vocabulary class that just defines the IRIs used in the OWL2, and its JavaDoc includes (emphasis added):

    OWL2 vocabulary. NOTE: Jena does not provide OWL2 inference or OntModel support. These constants are provided for the convenience of users who are doing OWL2 work with the current OWL1 support and desire a suitable set of names.