Last active
June 4, 2018 18:18
-
-
Save Locke/c275b45823f014ba4a09400fe462c39d to your computer and use it in GitHub Desktop.
NullPointerException in BlockingContext.moveBlockerUp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.athalis.owl; | |
import java.io.File; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import openllet.owlapi.OpenlletReasoner; | |
import openllet.owlapi.OpenlletReasonerFactory; | |
import org.semanticweb.owlapi.apibinding.*; | |
import org.semanticweb.owlapi.model.*; | |
import org.semanticweb.owlapi.reasoner.*; | |
class App { | |
public static void main(String[] args) throws OWLOntologyCreationException { | |
App app = new App(); | |
File individualsFile = new File("./src/main/resources/individuals.owl"); | |
app.readIndividuals(individualsFile); | |
app.dispose(); | |
} | |
private final OWLOntologyManager manager; | |
private final InputStream ontFileStream; | |
private final OWLOntology standardOnt; | |
private App() throws OWLOntologyCreationException { | |
//openllet.shared.tools.Log._defaultLevel = Level.ALL; | |
//openllet.shared.tools.Log.setLevel(Level.ALL); | |
manager = OWLManager.createOWLOntologyManager(); | |
// pre-load ontology from file to avoid download | |
ontFileStream = App.class.getClassLoader().getResourceAsStream("ont.owl"); | |
standardOnt = manager.loadOntologyFromOntologyDocument(ontFileStream); | |
} | |
private void readIndividuals(File file) throws OWLOntologyCreationException { | |
OWLOntology ont = manager.loadOntologyFromOntologyDocument(file); | |
ConsoleProgressMonitor progressMonitor = new ConsoleProgressMonitor(); | |
OWLReasonerConfiguration config = new SimpleConfiguration(progressMonitor); | |
OpenlletReasoner reasoner = OpenlletReasonerFactory.getInstance().createReasoner(ont, config); | |
if (!reasoner.isConsistent()) { | |
throw new IllegalArgumentException("inconsistent individuals file!"); | |
} | |
reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY); // throws java.lang.NullPointerException | |
// do stuff.. | |
reasoner.dispose(); | |
manager.removeOntology(ont); | |
} | |
private void dispose() { | |
manager.removeOntology(standardOnt); | |
try { | |
ontFileStream.close(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prefix(:=<http://main#>) | |
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#>) | |
Ontology(<http://main> | |
<http://main_0.0> | |
Declaration(Class(:ModelElement)) | |
Declaration(Class(:Worker)) | |
Declaration(Class(<x:cls/Action>)) | |
Declaration(Class(<x:cls/OverloadStrategy>)) | |
Declaration(Class(<x:cls/State>)) | |
Declaration(Class(<x:cls/Transition>)) | |
Declaration(Class(<x:cls/TransitionCondition>)) | |
Declaration(ObjectProperty(:hasStrategy)) | |
Declaration(ObjectProperty(<x:op/belongsTo>)) | |
Declaration(ObjectProperty(<x:op/contains>)) | |
Declaration(ObjectProperty(<x:op/hasOutgoingTransition>)) | |
Declaration(ObjectProperty(<x:op/hasTransitionCondition>)) | |
Declaration(NamedIndividual(<x:ind/state1>)) | |
Declaration(NamedIndividual(<x:ind/strategy1>)) | |
Declaration(NamedIndividual(<x:ind/strategy2>)) | |
Declaration(NamedIndividual(<x:ind/strategy3>)) | |
Declaration(NamedIndividual(<x:ind/strategy4>)) | |
Declaration(NamedIndividual(<x:ind/transition1>)) | |
Declaration(NamedIndividual(<x:ind/transitionCondition1>)) | |
############################ | |
# Object Properties | |
############################ | |
# Object Property: :hasStrategy (:hasStrategy) | |
SubObjectPropertyOf(:hasStrategy owl:topObjectProperty) | |
ObjectPropertyDomain(:hasStrategy :Worker) | |
ObjectPropertyRange(:hasStrategy <x:cls/OverloadStrategy>) | |
# Object Property: <x:op/belongsTo> (<x:op/belongsTo>) | |
InverseObjectProperties(<x:op/belongsTo> <x:op/contains>) | |
ObjectPropertyDomain(<x:op/belongsTo> :ModelElement) | |
ObjectPropertyRange(<x:op/belongsTo> :ModelElement) | |
# Object Property: <x:op/contains> (<x:op/contains>) | |
ObjectPropertyDomain(<x:op/contains> :ModelElement) | |
ObjectPropertyRange(<x:op/contains> :ModelElement) | |
# Object Property: <x:op/hasOutgoingTransition> (<x:op/hasOutgoingTransition>) | |
ObjectPropertyDomain(<x:op/hasOutgoingTransition> <x:cls/State>) | |
ObjectPropertyRange(<x:op/hasOutgoingTransition> <x:cls/Transition>) | |
# Object Property: <x:op/hasTransitionCondition> (<x:op/hasTransitionCondition>) | |
ObjectPropertyDomain(<x:op/hasTransitionCondition> <x:cls/Transition>) | |
############################ | |
# Classes | |
############################ | |
# Class: :Worker (:Worker) | |
SubClassOf(:Worker :ModelElement) | |
SubClassOf(:Worker ObjectSomeValuesFrom(<x:op/contains> <x:cls/Action>)) | |
SubClassOf(:Worker ObjectExactCardinality(1 :hasStrategy <x:cls/OverloadStrategy>)) | |
# Class: <x:cls/Action> (<x:cls/Action>) | |
SubClassOf(<x:cls/Action> :ModelElement) | |
SubClassOf(<x:cls/Action> ObjectSomeValuesFrom(<x:op/contains> <x:cls/Transition>)) | |
SubClassOf(<x:cls/Action> ObjectExactCardinality(1 <x:op/contains> <x:cls/State>)) | |
# Class: <x:cls/OverloadStrategy> (<x:cls/OverloadStrategy>) | |
EquivalentClasses(<x:cls/OverloadStrategy> ObjectOneOf(<x:ind/strategy1> <x:ind/strategy2> <x:ind/strategy3> <x:ind/strategy4>)) | |
# Class: <x:cls/State> (<x:cls/State>) | |
SubClassOf(<x:cls/State> :ModelElement) | |
SubClassOf(<x:cls/State> ObjectSomeValuesFrom(<x:op/hasOutgoingTransition> <x:cls/Transition>)) | |
SubClassOf(<x:cls/State> ObjectExactCardinality(1 <x:op/belongsTo> <x:cls/Action>)) | |
# Class: <x:cls/Transition> (<x:cls/Transition>) | |
SubClassOf(<x:cls/Transition> :ModelElement) | |
SubClassOf(<x:cls/Transition> ObjectExactCardinality(1 <x:op/hasTransitionCondition> <x:cls/TransitionCondition>)) | |
# Class: <x:cls/TransitionCondition> (<x:cls/TransitionCondition>) | |
SubClassOf(<x:cls/TransitionCondition> :ModelElement) | |
############################ | |
# Named Individuals | |
############################ | |
# Individual: <x:ind/state1> (<x:ind/state1>) | |
ClassAssertion(<x:cls/State> <x:ind/state1>) | |
# Individual: <x:ind/transition1> (<x:ind/transition1>) | |
ClassAssertion(<x:cls/Transition> <x:ind/transition1>) | |
ObjectPropertyAssertion(<x:op/hasTransitionCondition> <x:ind/transition1> <x:ind/transitionCondition1>) | |
DLSafeRule(Body(ClassAtom(<x:cls/State> Variable(<urn:swrl#x>)) ClassAtom(<x:cls/Transition> Variable(<urn:swrl#y>)) ObjectPropertyAtom(<x:op/belongsTo> Variable(<urn:swrl#x>) Variable(<urn:swrl#z>)) ObjectPropertyAtom(<x:op/hasOutgoingTransition> Variable(<urn:swrl#x>) Variable(<urn:swrl#y>)) ClassAtom(<x:cls/Action> Variable(<urn:swrl#z>)))Head(ObjectPropertyAtom(<x:op/contains> Variable(<urn:swrl#z>) Variable(<urn:swrl#y>)))) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prefix(:=<http://main#>) | |
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#>) | |
Ontology(<http://main> | |
<http://main_0.0> | |
Declaration(Class(<x:cls/108>)) | |
Declaration(Class(<x:cls/112>)) | |
Declaration(Class(<x:cls/113>)) | |
Declaration(Class(<x:cls/91>)) | |
Declaration(Class(<x:cls/96>)) | |
Declaration(ObjectProperty(<x:op/118>)) | |
Declaration(ObjectProperty(<x:op/119>)) | |
Declaration(ObjectProperty(<x:op/133>)) | |
Declaration(ObjectProperty(<x:op/140>)) | |
Declaration(NamedIndividual(<x:ind/0>)) | |
Declaration(NamedIndividual(<x:ind/1>)) | |
Declaration(NamedIndividual(<x:ind/2>)) | |
Declaration(NamedIndividual(<x:ind/3>)) | |
Declaration(NamedIndividual(<x:ind/38>)) | |
Declaration(NamedIndividual(<x:ind/52>)) | |
Declaration(NamedIndividual(<x:ind/83>)) | |
############################ | |
# Classes | |
############################ | |
# Class: <x:cls/108> (<x:cls/108>) | |
SubClassOf(<x:cls/108> ObjectSomeValuesFrom(<x:op/133> <x:cls/112>)) | |
SubClassOf(<x:cls/108> ObjectExactCardinality(1 <x:op/118> <x:cls/91>)) | |
# Class: <x:cls/112> (<x:cls/112>) | |
SubClassOf(<x:cls/112> ObjectExactCardinality(1 <x:op/140> <x:cls/113>)) | |
# Class: <x:cls/96> (<x:cls/96>) | |
EquivalentClasses(<x:cls/96> ObjectOneOf(<x:ind/0> <x:ind/1> <x:ind/2> <x:ind/3>)) | |
############################ | |
# Named Individuals | |
############################ | |
# Individual: <x:ind/38> (<x:ind/38>) | |
ClassAssertion(<x:cls/112> <x:ind/38>) | |
ObjectPropertyAssertion(<x:op/140> <x:ind/38> <x:ind/83>) | |
# Individual: <x:ind/52> (<x:ind/52>) | |
ClassAssertion(<x:cls/108> <x:ind/52>) | |
DLSafeRule(Body(ClassAtom(<x:cls/108> Variable(<urn:swrl#x>)) ClassAtom(<x:cls/112> Variable(<urn:swrl#y>)) ClassAtom(<x:cls/91> Variable(<urn:swrl#z>)) ObjectPropertyAtom(<x:op/133> Variable(<urn:swrl#x>) Variable(<urn:swrl#y>)) ObjectPropertyAtom(<x:op/118> Variable(<urn:swrl#x>) Variable(<urn:swrl#z>)))Head(ObjectPropertyAtom(<x:op/119> Variable(<urn:swrl#z>) Variable(<urn:swrl#y>)))) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>de.athalis.owl</groupId> | |
<artifactId>openllet-moveBlockerUp</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>openllet-moveBlockerUp</name> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<build> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<version>3.6.0</version> | |
<configuration> | |
<source>1.8</source> | |
<target>1.8</target> | |
</configuration> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<dependency> | |
<groupId>net.sourceforge.owlapi</groupId> | |
<artifactId>owlapi-api</artifactId> | |
<version>5.1.5</version> | |
</dependency> | |
<dependency> | |
<groupId>com.github.galigator.openllet</groupId> | |
<artifactId>openllet-owlapi</artifactId> | |
<version>2.6.4</version> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment