2

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.

Ania David
  • 1,168
  • 1
  • 15
  • 36
  • Why would fuseki infer anything at all? You'd have to attach an OWL reasoner if you want fuseki to respond with OWL inferences. – Joshua Taylor Mar 30 '16 at 12:19
  • @JoshuaTaylor I already put the OWL reasoner in my fuseki. otherwise, it wouldn't have infered that I am a female User – Ania David Mar 30 '16 at 12:49
  • @JoshuaTaylor this time I made a very minimual ontology where it just contains the problem, and my query is just about the problem, i made that during the debugging process in which i was trying to solve a bigger problem. – Ania David Mar 30 '16 at 12:59
  • 1
    In this case, it does make a difference. The OWL reasoners supplied with Jena are not logically complete; that means that (by design) there are OWL inferences that they won't compute. 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, I expect that 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. – Joshua Taylor Mar 30 '16 at 13:15
  • 1
    A possibility is to use a FILTER in SPARQL. `User hasAge ?X . FILTER (?X >= 16).` This can be wrapped in an `EXISTS`. – AndyS Mar 30 '16 at 13:57

1 Answers1

2

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.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • wow, that is a *punch at the face*, a big percentage of my work depends on data range constrains. In the past I was using quering the triples that the Protege OWL reasoner produces, now I'm socked, any solution to recover that please? (the link you put doesn't work) – Ania David Mar 30 '16 at 13:23
  • If you read the rest of the thread that I linked to, you'll see that it may be possible to use Pellet or other reasoners along with Fuseki. Protege, as far as I know, doesn't have its own OWL reasoner, but uses other reasoners that expose an API. Jena can use some of those same reasoners. – Joshua Taylor Mar 30 '16 at 13:23
  • @AniaDavid I did some edits to my answer, can you check whether the link works now or not? It does work for me. (Be sure to refresh the answer.) – Joshua Taylor Mar 30 '16 at 13:25
  • The link is working thanks, please do you have any page official states that Jena doesn't support OWL 2? I'm checking the link, it is just a question, how can I see the answer to it please ? – Ania David Mar 30 '16 at 13:29
  • 1
    depressed and devastated – Ania David Mar 30 '16 at 13:44
  • @Ania As I said, read the other messages in the thread. There's are links to the previous and next messages in the thread. They look like **« Thread »**. Note that the user did have some difficulty using Pellet. The rest of the messages in the thread won't completely solve your problem, but may help you toward a solution. – Joshua Taylor Mar 30 '16 at 13:57
  • @AniaDavid As to an official statement of non-support of OWL2, I've updated my answer. – Joshua Taylor Mar 30 '16 at 14:00
  • I know it is a separated question,(they don't allow me to add new question due to low quality questions ) execuse me, but please do you know how to add the Pellet library to Fuseki? – Ania David Mar 30 '16 at 14:52
  • @AniaDavid A Google search for "use pellet with fuseki" turns up [Fuseki using Pellet Inference](https://datababel.wordpress.com/2013/06/26/fuseki-using-pellet-inference/), which looks promising, and includes from Fuseki configuration content. Did you try the things suggested in there? Without specific problems, I don't think you'll get too much guidance from Stack Overflow. – Joshua Taylor Mar 30 '16 at 15:07
  • I already saw that because I also searched online, but that link is for Fuseki 0.2.7 not 2.3.1, now my problem is how to add this Pellet reasoner to Fuseki so I can use it instead of the build in OWL jena reasoner. I will ask a new question when they allow me, I already knew that I need to set the ReasonerClass in Fuseki config.tt, I did but the problem is I don't know how to include the Pellet library (and where to get them from, the Githut for Pellet doesnt' have a release jars) – Ania David Mar 30 '16 at 15:13
  • This page helped me in how to include the jars I want, I just need to find the jars for Pellet https://jena.apache.org/documentation/permissions/example.html – Ania David Mar 30 '16 at 15:26
  • You could *compile* the code from GitHub and thus build the jars, but you might also have some luck with the jars that you can get from Maven. See http://search.maven.org/#search|ga|1|pellet. – Joshua Taylor Mar 30 '16 at 15:31
  • Okay I got the jars from maven, and I asked a new question here https://stackoverflow.com/questions/36313972/fuseki-how-to-add-pellet-reasoner – Ania David Mar 30 '16 at 15:56