Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 5 additions & 23 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,35 +154,17 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-api</artifactId>
<version>4.5.29</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-apibinding</artifactId>
<version>4.5.29</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-rio</artifactId>
<version>4.5.29</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>
</exclusions>
<version>5.5.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down Expand Up @@ -221,7 +203,7 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>org.semanticweb.hermit</artifactId>
<version>1.4.5.456</version>
<version>1.4.5.519</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.owlapi</groupId>
Expand Down Expand Up @@ -256,7 +238,7 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>jfact</artifactId>
<version>4.0.4</version>
<version>5.0.3</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.owlapi</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public CommandState execute(CommandState state, String[] args) throws Exception
ontology
.getOntologyID()
.getVersionIRI()
.or(ontology.getOntologyID().getOntologyIRI().orNull());
.orElse((ontology.getOntologyID().getOntologyIRI().orElse(null)));
if (provenanceIRI != null) {
OWLAnnotationProperty annotationProp =
ontology
Expand All @@ -331,7 +331,7 @@ public CommandState execute(CommandState state, String[] args) throws Exception
boolean definedBy = CommandLineHelper.getBooleanValue(line, "annotate-defined-by", false);
if (definedBy) {
hasAnnotation = true;
IRI ontIRI = ontology.getOntologyID().getOntologyIRI().orNull();
IRI ontIRI = ontology.getOntologyID().getOntologyIRI().orElse(null);
if (ontIRI != null) {
OWLAnnotationProperty rdfsIsDefinedBy =
ontology.getOWLOntologyManager().getOWLDataFactory().getRDFSIsDefinedBy();
Expand Down Expand Up @@ -369,8 +369,8 @@ public CommandState execute(CommandState state, String[] args) throws Exception
* @return the updated string
*/
private String expandValue(String value, OWLOntology ontology) {
IRI ontologyIRI = ontology.getOntologyID().getOntologyIRI().orNull();
IRI versionIRI = ontology.getOntologyID().getVersionIRI().orNull();
IRI ontologyIRI = ontology.getOntologyID().getOntologyIRI().orElse(null);
IRI versionIRI = ontology.getOntologyID().getVersionIRI().orElse(null);
if (ontologyIRI != null) {
value = value.replace("%{ontology_iri}", ontologyIRI.toString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ private static OWLOntology mireotExtract(
// Get the output IRI and create the output ontology
IRI outputIRI = CommandLineHelper.getOutputIRI(line);
if (outputIRI == null) {
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orNull();
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orElse(null);
}
OWLOntology outputOntology = MergeOperation.merge(outputOntologies);
if (outputIRI != null) {
Expand Down Expand Up @@ -344,7 +344,7 @@ private static OWLOntology slmeExtract(
// Get the output IRI
IRI outputIRI = CommandLineHelper.getOutputIRI(line);
if (outputIRI == null) {
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orNull();
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orElse(null);
}

return ExtractOperation.extract(
Expand Down Expand Up @@ -397,7 +397,7 @@ private static OWLOntology subsetExtract(
// Get the output IRI
IRI outputIRI = CommandLineHelper.getOutputIRI(line);
if (outputIRI == null) {
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orNull();
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orElse(null);
}

return ExtractOperation.extractSubset(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ private static OWLOntology getOutputOntology(CommandLine line, OWLOntology input
outputIRI = IRI.create(outputIRIString);
} else {
// If it is not provided, copy the input IRI
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orNull();
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orElse(null);
}

// Create the output ontology
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public CommandState execute(CommandState state, String[] args) throws Exception

IRI outputIRI = CommandLineHelper.getOutputIRI(line);
if (outputIRI == null) {
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orNull();
outputIRI = inputOntology.getOntologyID().getOntologyIRI().orElse(null);
}

boolean repairInvalidReferences =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ public CommandState execute(CommandState state, String[] args) throws Exception
if (!report.isInProfile()) {
throw new Exception(
String.format(
profileViolationError, ontology.getOntologyID().getOntologyIRI().orNull(), profile));
profileViolationError,
ontology.getOntologyID().getOntologyIRI().orElse(null),
profile));
}
return state;
}
Expand Down
52 changes: 6 additions & 46 deletions robot-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,47 +33,7 @@
</plugin>

<!-- Ensure backward compatibility -->
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
<version>0.15.4</version>
<configuration>
<oldVersion>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>1.9.11</version> <!-- japicmp target -->
<type>jar</type>
</dependency>
</oldVersion>
<newVersion>
<file>
<path>${project.build.directory}/${project.artifactId}-${project.version}.${project.packaging}</path>
</file>
</newVersion>
<parameter>
<!-- see documentation: http://siom79.github.io/japicmp/MavenPlugin.html -->
<breakBuildOnBinaryIncompatibleModifications>true</breakBuildOnBinaryIncompatibleModifications>
<breakBuildOnSourceIncompatibleModifications>true</breakBuildOnSourceIncompatibleModifications>
<!-- include on breaking changes
<excludes></excludes>
-->
<ignoreMissingClassesByRegularExpressions>
<!-- To handle sesame-rio-api-2.7.16.jar -> rdf4j-rio-api-2.4.2.jar lib change on owlapi 4.5.25 upgrade: -->
<!-- This ignore can be removed in consecutive releases -->
<ignoreMissingClassesByRegularExpression>org.openrdf.rio.*</ignoreMissingClassesByRegularExpression>
</ignoreMissingClassesByRegularExpressions>
</parameter>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>cmp</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Remove for ROBOT 2 update -->
</plugins>
</build>

Expand All @@ -86,7 +46,7 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-api</artifactId>
<version>4.5.29</version>
<version>5.5.1</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
Expand All @@ -97,7 +57,7 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-apibinding</artifactId>
<version>4.5.29</version>
<version>5.5.1</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
Expand All @@ -108,7 +68,7 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlapi-rio</artifactId>
<version>4.5.29</version>
<version>5.5.1</version>
<exclusions>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
Expand Down Expand Up @@ -241,7 +201,7 @@
<dependency>
<groupId>net.sourceforge.owlapi</groupId>
<artifactId>owlexplanation</artifactId>
<version>2.0.0</version>
<version>5.0.1</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.owlapi</groupId>
Expand Down Expand Up @@ -275,7 +235,7 @@
<dependency>
<groupId>org.geneontology</groupId>
<artifactId>owl-diff_${scala.version}</artifactId>
<version>1.3.0</version>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>net.sourceforge.owlapi</groupId>
Expand Down
12 changes: 12 additions & 0 deletions robot-core/src/main/java/org/obolibrary/robot/DiffOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import org.geneontology.owl.differ.Differ;
import org.geneontology.owl.differ.render.BasicDiffRenderer;
Expand Down Expand Up @@ -201,6 +202,17 @@ public DualOntologySetProvider(OWLOntologySetProvider left, OWLOntologySetProvid
public Set<OWLOntology> getOntologies() {
return Collections.unmodifiableSet(ontologies);
}

/**
* Get the ontologies in the provider.
*
* @return Set of OWLOntologies
*/
@Nonnull
@Override
public Stream<OWLOntology> ontologies() {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is required to implement HasGetOntologies.

return ontologies.stream();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static void expand(
ax ->
executeConstruct(
dataset,
ax.getValue().asLiteral().orNull().getLiteral(),
ax.getValue().asLiteral().orElse(null).getLiteral(),
(IRI) (ax.getSubject()),
config.getAnnotateExpansionAxioms()))
.reduce(ExpandOperation::combine)
Expand All @@ -126,7 +126,7 @@ private static Set<OWLAxiom> executeConstruct(
OWLManager.getOWLDataFactory().getOWLAnnotation(dctSource, definitionTerm));
annotatedAxioms =
axioms.stream()
.map(ax -> ax.getAnnotatedAxiom(sourceAnnotation))
.map(ax -> (OWLAxiom) ax.getAnnotatedAxiom(sourceAnnotation))
.collect(Collectors.toSet());
} else {
annotatedAxioms = axioms;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public static Set<Explanation<OWLAxiom>> explain(
logger.debug("Explaining: " + axiom);

ExplanationGeneratorFactory<OWLAxiom> genFac =
ExplanationManager.createExplanationGeneratorFactory(reasonerFactory);
ExplanationManager.createExplanationGeneratorFactory(
reasonerFactory, OWLManager::createOWLOntologyManager);
ExplanationGenerator<OWLAxiom> gen = genFac.createExplanationGenerator(ontology);
return gen.getExplanations(axiom, maxExplanations);
}
Expand All @@ -68,7 +69,11 @@ public static Set<Explanation<OWLAxiom>> explain(
public static Set<Explanation<OWLAxiom>> explainInconsistent(
OWLOntology ontology, OWLReasonerFactory reasonerFactory, int max) {
InconsistentOntologyExplanationGeneratorFactory igf =
new InconsistentOntologyExplanationGeneratorFactory(reasonerFactory, 10000);
new InconsistentOntologyExplanationGeneratorFactory(
reasonerFactory,
OWLManager.getOWLDataFactory(),
OWLManager::createOWLOntologyManager,
10000);
ExplanationGenerator<OWLAxiom> generator = igf.createExplanationGenerator(ontology);
OWLAxiom entailment = df.getOWLSubClassOfAxiom(df.getOWLThing(), df.getOWLNothing());
return generator.getExplanations(entailment, max);
Expand Down Expand Up @@ -126,8 +131,7 @@ public static Set<Explanation<OWLAxiom>> explainUnsatisfiableClasses(
public static Set<Explanation<OWLAxiom>> explainRootUnsatisfiableClasses(
OWLOntology ontology, OWLReasoner reasoner, OWLReasonerFactory reasonerFactory, int max) {
RootDerivedReasoner rootReasoner =
new StructuralRootDerivedReasoner(
ontology.getOWLOntologyManager(), reasoner, reasonerFactory);
new StructuralRootDerivedReasoner(ontology.getOWLOntologyManager(), reasoner);
List<OWLClass> unsatisfiable_classes =
new ArrayList<>(rootReasoner.getRootUnsatisfiableClasses());
return getUnsatExplanationsForClasses(ontology, reasonerFactory, max, unsatisfiable_classes);
Expand Down Expand Up @@ -221,7 +225,7 @@ Determine source ontologies (if imports are present).
sb.append("\n\n" + "# Ontologies used: " + "\n");
for (OWLOntologyID oid : ontologyIdAbbreviation.keySet()) {
String soid = ontologyIdAbbreviation.get(oid);
String oiri = oid.getOntologyIRI().or(IRI.create("unknown.iri")).toString();
String oiri = oid.getOntologyIRI().orElse(IRI.create("unknown.iri")).toString();
sb.append("- ").append(soid).append(" (").append(oiri).append(")\n");
}
return sb.toString();
Expand Down
Loading
Loading