Galigator / openllet

Openllet is an OWL 2 reasoner in Java, build on top of Pellet.
https://www.w3.org/TR/owl2-primer/
Other
99 stars 26 forks source link

Reasoner `.bindSchema` doesn't work #63

Open nschejtman opened 3 years ago

nschejtman commented 3 years ago

I've got the following code which receives two models, one that comes from reading instance data and another from reading an ontology data. Jena's defaul OWL reasoner works just fine like this:

def default(data: Model, schema: Model): InfModel = {
  val reasoner = ReasonerRegistry.getOWLReasoner.bindSchema(schema)
  return ModelFactory.createInfModel(reasoner, data)
}

I'm able to perform basic inferences like:

However, when using Openllet's reasoner I'm not able to perform even these basic inferences. What am I missing?

Just in case this was my attempt:

def pellet(data: Model, schema: Model): InfModel = {
  val reasoner = PelletReasonerFactory.theInstance().create().bindSchema(schema)
  return ModelFactory.createInfModel(reasoner, data)
}

Concrete example:

Data:

@prefix i:            <file://src/test/resources/basic/data#> .
@prefix o:            <file://src/test/resources/basic/ontology#> .

i:Argentina
    a o:Country .

i:BuenosAires
    a o:Province .

Schema:

@prefix :            <file://src/test/resources/basic/ontology#> .
@prefix owl:         <http://www.w3.org/2002/07/owl#> .
@prefix rdf:         <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:        <http://www.w3.org/2000/01/rdf-schema#> .
@base <file://src/test/resources/basic/ontology#> .

<file://src/test/resources/basic/ontology#>
    rdf:type owl:Ontology .

:Region a owl:Class .

:Country
    rdfs:subClassOf :Region .

:Province
    rdfs:subClassOf :Region .

Query:

PREFIX i: <file://src/test/resources/basic/data#>
PREFIX o: <file://src/test/resources/basic/ontology#>
ASK {
    i:Argentina a o:Region .
    i:BuenosAires a o:Region .
    }

Running that query against the inference model from Jena's default OWL reasoner returns true while Pellet returns false

nschejtman commented 3 years ago

Looks like this is a bug. The workaround by creating the infModel directly with the union of both my data and schema