Giter Club home page Giter Club logo

snorocket's Introduction

Snorocket

This project contains three modules:

  • snorocket-core: This is the core classifier code.
  • snorocket-owlapi: An implementation of the OWLReasoner interface based on Snorocket.
  • snorocket-protege: The implementation of the Snorocket Protege plugin.

Version 3.0.0 reverts back to depending on OWL-API 4.x to regain compatibility with Protege

snorocket's People

Contributors

ametke avatar ignazio1977 avatar lawley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

snorocket's Issues

Latest version - 2.8.1 crashes in Protege 5.1.0

Installed snorocket-protege-2.8.1-jar-with-dependencies.jar into the java/plugins directory. Running the reasoner gives:

017-10-16 03:27:12.607 [Classification Thread] INFO OWLReasonerManager ------------------------------- Running Reasoner -------------------------------
2017-10-16 03:27:12.736 [Classification Thread] INFO OWLReasonerManager
2017-10-16 03:27:12.740 [Classification Thread] ERROR OWLReasonerManager An error occurred during reasoning: org.semanticweb.owlapi.model.OWLOntology.importsClosure()Ljava/util/stream/Stream;.
java.lang.NoSuchMethodError: org.semanticweb.owlapi.model.OWLOntology.importsClosure()Ljava/util/stream/Stream;
at au.csiro.snorocket.owlapi.SnorocketOWLReasoner.getAxioms(SnorocketOWLReasoner.java:274) ~[na:na]
at au.csiro.snorocket.owlapi.SnorocketOWLReasoner.(SnorocketOWLReasoner.java:141) ~[na:na]
at au.csiro.snorocket.owlapi.SnorocketReasonerFactory.createReasoner(SnorocketReasonerFactory.java:42) ~[na:na]
at org.protege.editor.owl.model.inference.ReasonerUtilities.createReasoner(ReasonerUtilities.java:20) ~[na:na]
at org.protege.editor.owl.model.inference.OWLReasonerManagerImpl$ClassificationRunner.ensureRunningReasonerInitialized(OWLReasonerManagerImpl.java:428) ~[na:na]
at org.protege.editor.owl.model.inference.OWLReasonerManagerImpl$ClassificationRunner.run(OWLReasonerManagerImpl.java:386) ~[na:na]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_40]

New to Protege & SnoRocket

Could someone help me load SnoRocket onto protege as a reasoner. It is not available from the check for plugins tab in the latest version of Protege (5.5.0). I am pretty sure I have to add it manually into the plugins folder of Protege. But I am not sure what all I need to do.
Thanks.

Modeling Role Groups in the Snorocket API

Could someone point me to a piece of documentation or code example explaining or demonstrating how to represent a role group in an axiom in the Snorocket API? The example code mentions role groups, but I don't see any specific examples.
Thanks!

Filtering redundant roles from inferred axioms

Given the following concepts:

  • Heart
  • Heart-Valve
  • Heart-Disease
  • Heart-Valve-Disease

and the following roles:

  • part-of
  • located-in

Such that part-of is the right identity of located-in, I have defined the following axioms:

Concept [id=Heart-Valve-Disease] ⊑ (located-in.Concept [id=Heart-Valve] + Concept [id=ROOT])
(located-in.Concept [id=Heart] + Concept [id=ROOT]) ⊑ Concept [id=Heart-Disease]
Concept [id=Heart-Disease] ⊑ (located-in.Concept [id=Heart] + Concept [id=ROOT])
Concept [id=Heart-Valve] ⊑ (part-of.Concept [id=Heart] + Concept [id=ROOT])
Concept [id=Heart] ⊑ Concept [id=ROOT]
located-in o part-of ⊑ located-in

After classifying with the Snorocket Reasoner, I get the following inferred axioms:
(retrieved using reasoner.getInferredAxioms())

Concept [id=Heart-Valve-Disease] ⊑ (located-in.Concept [id=Heart] + located-in.Concept [id=Heart-Valve] + Concept [id=Heart-Disease])
Concept [id=Heart-Disease] ⊑ (located-in.Concept [id=Heart] + Concept [id=ROOT])
Concept [id=Heart] ⊑ Concept [id=ROOT]
Concept [id=Heart-Valve] ⊑ (part-of.Concept [id=Heart] + Concept [id=ROOT])

This seems mostly correct, except the axiom for Heart-Valve-Disease, which includes both existentials located-in.(Heart) and located-in.(Heart-Valve), which I believe is redundant. Some comments in the core project mention that some redundant roles may exist in the inferred axioms, so I'm assuming this is an example of that possible redundancy.

It would seem to me that this kind of redundancy must have already been addressed in order to successfully classify SNOMED CT, but I can find no mention of a solution.

My questions:
Is my assumption correct, that this redundancy is an expected side-effect in the Snorocket reasoner?
If so, is there an existing function or algorithm to remove these redundant roles, or must I write my own filter?
If not, is there an additional role axiom that I'm missing in the input to prevent this, or I am retrieving inferred axioms incorrectly? (or am I missing something else entirely?)

Thanks in advance for your help.

Role Inclusions and Role Groups

Hi again,
I'm having an issue trying to model a role inclusion while implementing the implicit role group that was discussed in issue #4. I have an example that has a role locatedIn and a right identity role partOf:

        Concept root = Factory.createNamedConcept("ROOT");
        Concept heart = Factory.createNamedConcept("Heart");
        Concept heartValve = Factory.createNamedConcept("Heart-Valve");
        Concept heartDisease = Factory.createNamedConcept("Heart-Disease");
        Concept heartValveDisease = Factory.createNamedConcept("Heart-Valve-Disease");

        Role locatedIn = Factory.createNamedRole("located-in");
        Role partOf = Factory.createNamedRole("part-of");

        axioms.add(Factory.createRoleInclusion(new Role[]{locatedIn, partOf}, locatedIn));

        axioms.add(Factory.createConceptInclusion(heart, root));

        Concept c, conj;

        c = heartValve;
        conj = Factory.createConjunction(root, Factory.createExistential(partOf, heart));
        axioms.add(Factory.createConceptInclusion(c, conj));

        c = heartDisease;
        conj = Factory.createConjunction(root, Factory.createExistential(locatedIn, heart));
        axioms.add(Factory.createConceptInclusion(c, conj));
        axioms.add(Factory.createConceptInclusion(conj, c));

        c = heartValveDisease;
        conj = Factory.createConjunction(root, Factory.createExistential(locatedIn, heartValve));
        axioms.add(Factory.createConceptInclusion(c, conj));

As expected in this example, Heart Valve Disease is subsumed by Heart Disease. However, when I add the implicit role groups discussed in issue #4, it no longer works (code below). I can see how adding the role group would affect this, but how do I model the role inclusion and role group such that Heart Valve Disease gets subsumed by Heart Disease? Do I need to add axioms both with and without the implicit role group, or is there something else I'm missing?

Thanks,
Dave

        Concept root = Factory.createNamedConcept("ROOT");
        Concept heart = Factory.createNamedConcept("Heart");
        Concept heartValve = Factory.createNamedConcept("Heart-Valve");
        Concept heartDisease = Factory.createNamedConcept("Heart-Disease");
        Concept heartValveDisease = Factory.createNamedConcept("Heart-Valve-Disease");

        Role locatedIn = Factory.createNamedRole("located-in");
        Role partOf = Factory.createNamedRole("part-of");
        Role roleGroup = Factory.createNamedRole("roleGroup");

        axioms.add(Factory.createRoleInclusion(new Role[]{locatedIn, partOf}, locatedIn));

        axioms.add(Factory.createConceptInclusion(heart, root));

        Concept c, conj;

        c = heartValve;
        conj = Factory.createConjunction(root, Factory.createExistential(roleGroup, Factory.createExistential(partOf, heart)));
        axioms.add(Factory.createConceptInclusion(c, conj));

        c = heartDisease;
        conj = Factory.createConjunction(root, Factory.createExistential(roleGroup, Factory.createExistential(locatedIn, heart)));
        axioms.add(Factory.createConceptInclusion(c, conj));
        axioms.add(Factory.createConceptInclusion(conj, c));

        c = heartValveDisease;
        conj = Factory.createConjunction(root, Factory.createExistential(roleGroup, Factory.createExistential(locatedIn, heartValve)));
        axioms.add(Factory.createConceptInclusion(c, conj));

interrupts and NIO and the Thread Pool Executor

Hi,
Have run into an odd issue, where the ThreadPool pattern of the classifier breaks other code.

This pattern:
`` ExecutorService executor = Executors.newFixedThreadPool(numThreads);
for (int j = 0; j < numThreads; j++) {
Runnable worker = new TaxonomyWorker1(contextIndex,
equiv, direc, factory, todo);
executor.execute(worker);
}

    executor.shutdown();
    while (!executor.isTerminated()) {
        try {
            Thread.sleep(100);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
    
    assert (todo.isEmpty());

Leads to a situation where the "shutdown()" call fires an interrupt at the idle threads in the pool. However, I'm guessing there are timing issues internally, about what is actually idle... in practice, I'm seeing interrupts hit threads that are or were involved with NIO on my side at one point or another, and this breaks the world, if NIO is involved.
https://docs.oracle.com/javase/7/docs/api/java/nio/channels/ClosedByInterruptException.html

Basically, my datastore, which uses NIO, gets killed by the call to shutdown() in the classifier, because the interrupt call kills the NIO file handle.

I think, that if you waited until todo.isEmpty() before calling shutdown() - that may solve the issue, but a simpler / more reliable solution may be to simply add an API where you allow us to pass in the executor to use - this way, I can hand in a thread pool I already have, and it doesn't have to be closed at all.

Thoughts?

${bundle.version} not replaced correctly in owlapi plugin.properties

Hi there,

I'm using version 4.0.1 of Snorocket in owlapi. When running the reasoner, I get the following exception:

Exception in thread "main" java.lang.NumberFormatException: For input string: "${bundle"
	at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:68)
	at java.base/java.lang.Integer.parseInt(Integer.java:644)
	at java.base/java.lang.Integer.parseInt(Integer.java:776)
	at au.csiro.snorocket.owlapi.SnorocketOWLReasoner.getReasonerVersion(SnorocketOWLReasoner.java:392)
	at org.semanticweb.owlapi.util.InferredOntologyGenerator.fillOntology(InferredOntologyGenerator.java:139)
	at org.unima.nheist.App.runReasoner(App.java:87)
	at org.unima.nheist.App.main(App.java:34)

which seems to happen because the string ${bundle.version} is not replaced correctly in the plugin.properties file of the Snorocket's owlapi-package. In the pom.xml of the protege-package, there is a section that defines the bundle.version:

<configuration>
  <name>bundle.version</name>
  <value>${project.version}</value>
  <regex>^([0-9]+)\.([0-9]+)\.([0-9]+)(-SNAPSHOT)?</regex>
  <replacement>$1.$2.$3</replacement>
  <failIfNoMatch>true</failIfNoMatch>
</configuration>

but that seems to be missing for the owlapi package.

Cheers, Nico

Snorocket fails in Protege DL-Query tab for IHTSDO alpha anatomy ontology

Protege 5.0.0 build beta-15 / snorocket 2.7.4 / IHTSDO alpha anatomy 9/2014.
After classification, query: rPartOf some humerus
Throws exception
ReasonerInternalException: Expected a named class, got ObjectSomeValuesFrom(http://snomed.info/sep/rPartOf http://snomed.info/sep/E18697)
au.csiro.snorocket.owlapi.SnorocketOWLReasoner.checkNamedClass(SnorocketOWLReasoner.java:947)
au.csiro.snorocket.owlapi.SnorocketOWLReasoner.getSubClasses(SnorocketOWLReasoner.java:911)
org.coode.dlquery.ResultsList.setOWLClassExpression(ResultsList.java:189)
org.coode.dlquery.OWLClassExpressionEditorViewComponent.doQuery(OWLClassExpressionEditorViewComponent.java:287)
org.coode.dlquery.OWLClassExpressionEditorViewComponent.access$000(OWLClassExpressionEditorViewComponent.java:56)
org.coode.dlquery.OWLClassExpressionEditorViewComponent$4.actionPerformed(OWLClassExpressionEditorViewComponent.java:143)
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
java.awt.Component.processMouseEvent(Component.java:6505)
javax.swing.JComponent.processMouseEvent(JComponent.java:3320)
java.awt.Component.processEvent(Component.java:6270)
java.awt.Container.processEvent(Container.java:2229)
java.awt.Component.dispatchEventImpl(Component.java:4861)
java.awt.Container.dispatchEventImpl(Container.java:2287)
java.awt.Component.dispatchEvent(Component.java:4687)
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
java.awt.Container.dispatchEventImpl(Container.java:2273)
java.awt.Window.dispatchEventImpl(Window.java:2719)
java.awt.Component.dispatchEvent(Component.java:4687)
java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735)
java.awt.EventQueue.access$200(EventQueue.java:103)
java.awt.EventQueue$3.run(EventQueue.java:694)
java.awt.EventQueue$3.run(EventQueue.java:692)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
java.awt.EventQueue$4.run(EventQueue.java:708)
java.awt.EventQueue$4.run(EventQueue.java:706)
java.security.AccessController.doPrivileged(Native Method)
java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
java.awt.EventQueue.dispatchEvent(EventQueue.java:705)
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Reasoner taking a very long time to classify

Hi all,
We've got an issue where we're classifying a client's extension of SNOMED CT, and the classify step is taking a very long time.

My process is: Classify SCT, and save the reasoner. When classifying the extension, load the SCT reasoner, add the appropriate axioms for the extension, and perform an incremental classification.

We've used this process on many other extensions of SCT and other ontologies, and performance is always excellent. However, in this case, classification is taking from 30-60 minutes. The extension includes about 11,000 concepts, about 13,000 defining concepts, and about 8,700 defining roles. There do not appear to be any cycles in the ontology.

I'm wondering if you are aware of any modeling conditions that might cause classification to take so long? I'm completely stumped at this point, because I'm not sure what I need to be looking for.

Thanks,
Dave

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.