Repository: ontodev/robot
Pull request #730 (2020-09-09 01:20:55)

Add Whelk reasoner.
Add Whelk as a reasoner choice.

- [x] `docs/` have been added/updated
- [x] tests have been added/updated
- [x] `mvn verify` says all tests pass
- [x] `mvn site` says all JavaDocs correct
- [x] `CHANGELOG.md` has been updated



Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 27208744..fe98f6ae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ## [Unreleased]
 
 ### Added
+- Add Whelk OWL reasoner in [#730]
 - Add [`validate`] command [#691]
 - Add `--errors <path>` option to [`template`] in [#713]
 
diff --git a/docs/reason.md b/docs/reason.md
index f77c7ac5..08c66a14 100644
--- a/docs/reason.md
+++ b/docs/reason.md
@@ -40,9 +40,10 @@ Finally, `reason` includes two more options to help clean the reasoned output:
 * `--remove-redundant-subclass-axioms`: if set to false, redundant axioms (those that have been asserted and were also inferred) are included in the output (default `true`).
 
 If no `--reasoner` is provided, ROBOT will default to ELK. The following other reasoner options are supported:
-  
+
   * `hermit` - [HermiT](http://www.hermit-reasoner.com/)
   * `jfact` - [JFact](http://jfact.sourceforge.net/)
+  * `whelk` - [Whelk](https://github.com/balhoff/whelk)
   * `emr` - [Expression Materializing Reasoner](http://static.javadoc.io/org.geneontology/expression-materializing-reasoner/0.1.3/org/geneontology/reasoner/ExpressionMaterializingReasoner.html)
   * `structural` - [Structural Reasoner](http://owlcs.github.io/owlapi/apidocs_4/org/semanticweb/owlapi/reasoner/structural/StructuralReasoner.html)
 
diff --git a/robot-command/src/main/java/org/obolibrary/robot/CommandLineHelper.java b/robot-command/src/main/java/org/obolibrary/robot/CommandLineHelper.java
index df0ba96c..9281e599 100644
--- a/robot-command/src/main/java/org/obolibrary/robot/CommandLineHelper.java
+++ b/robot-command/src/main/java/org/obolibrary/robot/CommandLineHelper.java
@@ -22,6 +22,7 @@ import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.io.IOExceptionWithCause;
 import org.apache.commons.io.filefilter.WildcardFileFilter;
 import org.geneontology.reasoner.ExpressionMaterializingReasonerFactory;
+import org.geneontology.whelk.owlapi.WhelkOWLReasonerFactory;
 import org.semanticweb.elk.owlapi.ElkReasonerFactory;
 import org.semanticweb.owlapi.model.*;
 import org.semanticweb.owlapi.reasoner.OWLReasonerFactory;
@@ -828,6 +829,8 @@ public class CommandLineHelper {
       return new ExpressionMaterializingReasonerFactory(innerReasonerFactory);
     } else if (reasonerName.equals("elk")) {
       return new org.semanticweb.elk.owlapi.ElkReasonerFactory();
+    } else if (reasonerName.equals("whelk")) {
+      return new WhelkOWLReasonerFactory();
     } else {
       throw new IllegalArgumentException(String.format(invalidReasonerError, reasonerName));
     }
diff --git a/robot-core/pom.xml b/robot-core/pom.xml
index 68bee4b6..491d8fc8 100644
--- a/robot-core/pom.xml
+++ b/robot-core/pom.xml
@@ -12,6 +12,10 @@
   <name>robot-core</name>
   <description>Core library for ROBOT: Library for working with OWL ontologies, especially Open Biological and Biomedical Ontologes (OBO).</description>
 
+  <properties>
+    <scala.version>2.12</scala.version>
+  </properties>
+
   <build>
     <plugins>
       <!-- Enforce Google Java Style -->
@@ -165,9 +169,14 @@
     </dependency>
     <dependency>
       <groupId>org.geneontology</groupId>
-      <artifactId>owl-diff_2.12</artifactId>
+      <artifactId>owl-diff_${scala.version}</artifactId>
       <version>1.2.1</version>
     </dependency>
+    <dependency>
+      <groupId>org.geneontology</groupId>
+      <artifactId>whelk-owlapi_${scala.version}</artifactId>
+      <version>1.0.1</version>
+    </dependency>
     <dependency>
       <groupId>com.google.code.gson</groupId>
       <artifactId>gson</artifactId>


Test patch:
diff --git a/robot-core/src/test/java/org/obolibrary/robot/ReasonOperationTest.java b/robot-core/src/test/java/org/obolibrary/robot/ReasonOperationTest.java
index 7e1cebce..a46266cd 100644
--- a/robot-core/src/test/java/org/obolibrary/robot/ReasonOperationTest.java
+++ b/robot-core/src/test/java/org/obolibrary/robot/ReasonOperationTest.java
@@ -6,6 +6,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 import org.geneontology.reasoner.ExpressionMaterializingReasonerFactory;
+import org.geneontology.whelk.owlapi.WhelkOWLReasonerFactory;
 import org.junit.Test;
 import org.semanticweb.HermiT.ReasonerFactory;
 import org.semanticweb.elk.owlapi.ElkReasonerFactory;
@@ -43,6 +44,19 @@ public class ReasonOperationTest extends CoreTest {
     assertIdentical("/simple_elk.owl", reasoned);
   }
 
+  /**
+   * Test reasoning with Whelk.
+   *
+   * @throws Exception on any problem
+   */
+  @Test
+  public void testWhelk() throws Exception {
+    OWLOntology reasoned = loadOntology("/simple.owl");
+    OWLReasonerFactory reasonerFactory = new WhelkOWLReasonerFactory();
+    ReasonOperation.reason(reasoned, reasonerFactory);
+    assertIdentical("/simple_elk.owl", reasoned);
+  }
+
   /**
    * Test reasoning with HermiT.
    *