owlcs / jfact

JFact repository
13 stars 8 forks source link

Invalid role expression: but got: (self-ref xxxxx) #10

Closed adrianR2 closed 8 years ago

adrianR2 commented 8 years ago

I get org.semanticweb.owlapi.reasoner.ReasonerInternalException: Invalid role expression: but got: (self-ref http://semantic.r-2apps.com/Occupation.ontology/OccupationOntology.v6.rdf.xml/Occupation#R_Legislators)

during classification for this ontology (that uses rolification)

http://semantic.r-2apps.com/Occupation.ontology/OccupationOntology.v6.rdf.xml

I'm using owlapi-osgidistribution-4.1.0.jar and jfact-4.0.0.jar

Code: OWLOntologyManager man = OWLManager.createOWLOntologyManager(); OWLOntology ontology = man.loadOntologyFromOntologyDocument(is); OWLReasonerConfiguration config = new SimpleConfiguration(50000); OWLReasoner reasoner = reasonerFactory.createReasoner(ontology, config); reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);

Is there any workaround ? Thank you.

ignazio1977 commented 8 years ago

The problem is in the translation between the ontology and JFact's internal representation - one of the role expressions has not been translated correctly.

tsarkov commented 8 years ago

It seems like a problem we faced a while ago, an extra translation call. Should be fixed in a recent version, could you check that?

ignazio1977 commented 8 years ago

The most recent JFact is 4.0.3 - it's compatible with all OWLAPI 4.x versions, 4.1.0 or 4.1.3 should both be good. I'd recommend 4.1.3 if you can upgrade.

ignazio1977 commented 8 years ago

I've tried replicating this locally and got a different failure: topObjectProperty is used incorrectly.

Use of non-simple property in a restriction: ObjectExactCardinality(1 owl:topObjectProperty

<Occupation#Chefs_and_cooks>) [ClassAssertion(ObjectExactCardinality(1 owl:topObjectProperty <Occupation#Chefs_and_cooks>) <Occupation#Cook>)]

This will still stop you from using the ontology after you update to a more recent JFact - it's not a bug per se, as this axiom is not an OWL 2 axiom.

If you cannot modify the original ontology, you'll have to remove the offending axiom before passing the ontology to JFact.

adrianR2 commented 8 years ago

The problem is in the translation between the ontology and JFact's internal representation - one of the role expressions has not been translated correctly.

Currently I get a 404 on your link - do you have a local copy of the ontology?

Thank you Ignazzio, please download it from https://app.box.com/s/thcasv98dbw1696l49ndqe5rak6wbhfz

I've tried replicating this locally and got a different failure: topObjectProperty is used incorrectly. [..]it's not a bug per se, as this axiom is not an OWL 2 axiom.

I created this ontology with Protege, not manually ... FaCT++ within Protege has no problem inferencing on it...

I'd recommend [OWLAPI] 4.1.3 if you can upgrade.

I could not find it so far.. Is there a jar available somewhere please?

ignazio1977 commented 8 years ago

OWLAPI 4.1.3 is available on Maven central:

http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22net.sourceforge.owlapi%22%20AND%20v%3A%224.1.3%22

I've just copied the files to sourceforge as well:

https://sourceforge.net/projects/owlapi/files/OWL%20API%20%28for%20OWL%202.0%29/4.1.3/

adrianR2 commented 8 years ago

Thank you Ignazzio.

[topObjectProperty] will still stop you from using the ontology after you update to a more recent JFact

Indeed, after updating to owlapi-osgidistribution-4.1.3.jar and jfact-4.0.3.jar the ontology cannot be classified, the process ‘hangs-up’ at 47%

Loading ... busy ... ... finished Classifying ... 1% … 47%

File f = new File("CompanyOntology.v4.rdf.xml");
InputStream is = new FileInputStream(f);
OWLReasonerFactory reasonerFactory = new JFactFactory();
OWLOntologyManager man = OWLManager.createOWLOntologyManager();
OWLOntology ontology = man.loadOntologyFromOntologyDocument(is);
ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor();
OWLReasonerConfiguration config = new SimpleConfiguration(progressMonitor);
OWLReasoner reasoner =  reasonerFactory.createReasoner( ontology, config); 
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);

On my side I did not get

Use of non-simple property in a restriction: ObjectExactCardinality(1 owl:topObjectProperty

With Pellet, the classification works, despite the 4 warnings

org.mindswap.pellet.RBox ignoreTransitivity
WARNING: Unsupported axiom: Ignoring transitivity and/or complex subproperty axioms for _TOP_OBJECT_PROPERTY_
org.mindswap.pellet.RBox ignoreTransitivity
WARNING: Unsupported axiom: Ignoring transitivity and/or complex subproperty axioms for may_employ
org.mindswap.pellet.RBox ignoreTransitivity
WARNING: Unsupported axiom: Ignoring transitivity and/or complex subproperty axioms for employs_Occupation
org.mindswap.pellet.RBox ignoreTransitivity
WARNING: Unsupported axiom: Ignoring transitivity and/or complex subproperty axioms for is_employed_by_Industry