Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reasoner .bindSchema doesn't work #63

Open
nschejtman opened this issue Jul 9, 2021 · 1 comment
Open

Reasoner .bindSchema doesn't work #63

nschejtman opened this issue Jul 9, 2021 · 1 comment

Comments

@nschejtman
Copy link

nschejtman commented Jul 9, 2021

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:

  • data: aMan a Man
  • schema: Man subClassOf Human
  • return: aMan a Human (plus others)

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 nschejtman changed the title How to setup reasoner with separate schema and data models .bindSchema doesn't work Aug 8, 2021
@nschejtman nschejtman changed the title .bindSchema doesn't work Reasoner .bindSchema doesn't work Aug 8, 2021
@nschejtman
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant