diff --git a/CHANGELOG.md b/CHANGELOG.md index b01190fcf..c3bc0127f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -- Downgrade SnakeYaml to 1.31 [#1070] +- Upgrade OWLAPI to 4.5.24 [#1086] +- Downgrade SnakeYaml to 1.31 [#1071] ## [1.9.1] - 2022-10-28 @@ -332,6 +333,8 @@ First official release of ROBOT! [`template`]: http://robot.obolibrary.org/template [`validate`]: http://robot.obolibrary.org/validate +[#1086]: https://github.com/ontodev/robot/pull/1086 +[#1071]: https://github.com/ontodev/robot/pull/1071 [#1061]: https://github.com/ontodev/robot/issues/1061 [#1030]: https://github.com/ontodev/robot/issues/1030 [#1026]: https://github.com/ontodev/robot/issues/1026 diff --git a/docs/examples/example.obo b/docs/examples/example.obo index af6df1d90..a3a30ed3d 100644 --- a/docs/examples/example.obo +++ b/docs/examples/example.obo @@ -1,7 +1,7 @@ format-version: 1.2 remark: Comment from annotations.ttl file. ontology: https://github.com/ontodev/robot/examples/edit.owl -owl-axioms: Prefix(owl:=)\nPrefix(rdf:=)\nPrefix(xml:=)\nPrefix(xsd:=)\nPrefix(rdfs:=)\n\n\nOntology(\nDeclaration(Class())\n############################\n# Classes\n############################\n\n# Class: (anatomical entity)\n\nSubClassOf( owl:Thing)\n\n\n) +owl-axioms: Prefix(owl:=)\nPrefix(rdf:=)\nPrefix(xml:=)\nPrefix(xsd:=)\nPrefix(rdfs:=)\n\n\nOntology(\nDeclaration(Class())\n############################\n# Classes\n############################\n\n# Class: ()\n\nSubClassOf( owl:Thing)\n\n\n) [Term] id: UBERON:0000061 diff --git a/docs/examples/example2_defined_by.owl b/docs/examples/example2_defined_by.owl index 542b1cf69..d15c175ac 100644 --- a/docs/examples/example2_defined_by.owl +++ b/docs/examples/example2_defined_by.owl @@ -31,7 +31,7 @@ - definition + definition @@ -45,9 +45,9 @@ - uberon + uberon - editor note + editor note @@ -55,9 +55,9 @@ - uberon + uberon - curator notes + curator notes @@ -121,6 +121,14 @@ + + + + + + + + @@ -145,7 +153,7 @@ - part_of + part_of @@ -166,7 +174,7 @@ - anatomical structure + anatomical structure @@ -182,7 +190,7 @@ - organ + organ @@ -226,7 +234,7 @@ - dummy individal 1 + dummy individal 1 @@ -241,7 +249,7 @@ - dummy individal 2 + dummy individal 2 @@ -250,7 +258,7 @@ - dummy individal 3 + dummy individal 3 @@ -265,7 +273,7 @@ - dummy individal 4 + dummy individal 4 @@ -274,10 +282,23 @@ - dummy individal 5 + dummy individal 5 + + + + + + - + + diff --git a/docs/examples/metrics_all.json b/docs/examples/metrics_all.json index 02f8eb570..84a663710 100644 --- a/docs/examples/metrics_all.json +++ b/docs/examples/metrics_all.json @@ -30,8 +30,8 @@ "dt_builtin_count_incl": 2, "dt_notbuiltin_count": 0, "dt_notbuiltin_count_incl": 0, - "expressivity": "SRIQ", - "expressivity_incl": "SRIQ", + "expressivity": "UCINTERIQ", + "expressivity_incl": "UCINTERIQ", "gci_count": 0, "gci_count_incl": 0, "gci_hidden_count": 105, @@ -46,8 +46,8 @@ "most_freq_concept_incl": "http://purl.obolibrary.org/obo/UBERON_0007530", "multiple_inheritance_count": 103, "multiple_inheritance_count_incl": 103, - "named_supercl_count_max": 1, - "named_supercl_count_max_incl": 1, + "named_supercl_count_max": 5, + "named_supercl_count_max_incl": 5, "obj_property_count": 49, "obj_property_count_incl": 49, "ontology_anno_count": 0, @@ -99,16 +99,20 @@ "InverseObjectProperties" ], "constructs": [ + "ROLE_INVERSE", "Q", - "R", - "S", - "I" + "CONCEPT_UNION", + "CONCEPT_INTERSECTION", + "FULL_EXISTENTIAL", + "ROLE_COMPLEX" ], "constructs_incl": [ + "ROLE_INVERSE", "Q", - "R", - "S", - "I" + "CONCEPT_UNION", + "CONCEPT_INTERSECTION", + "FULL_EXISTENTIAL", + "ROLE_COMPLEX" ], "datatypes_builtin": [ "XSD_STRING", @@ -172,12 +176,17 @@ "foaf": "http://xmlns.com/foaf/0.1/", "BSPO": "http://purl.obolibrary.org/obo/BSPO_" }, - "datatypes_axiom_count": {}, - "datatypes_axiom_count_incl": {}, + "datatypes_axiom_count": { + "XSD_STRING": 751 + }, + "datatypes_axiom_count_incl": { + "XSD_STRING": 751 + }, "namespace_axiom_count": { "oboInOwl": 4819, "IAO": 306, "UBERON": 1903, + "xsd": 751, "rdfs": 308, "BFO": 283, "obo": 235, @@ -189,6 +198,7 @@ "oboInOwl": 4819, "IAO": 306, "UBERON": 1903, + "xsd": 751, "rdfs": 308, "BFO": 283, "obo": 235, diff --git a/docs/examples/uvula_inconsistent_explanation.ofn b/docs/examples/uvula_inconsistent_explanation.ofn index 50965c63c..73a9102c3 100644 --- a/docs/examples/uvula_inconsistent_explanation.ofn +++ b/docs/examples/uvula_inconsistent_explanation.ofn @@ -19,12 +19,12 @@ Declaration(NamedIndividual()) # Class: (palatal muscle) -AnnotationAssertion(rdfs:label "palatal muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "palatal muscle") DisjointClasses( ) # Class: (uvular muscle) -AnnotationAssertion(rdfs:label "uvular muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "uvular muscle") SubClassOf( ) diff --git a/docs/examples/uvula_multiple_unsat_2.ofn b/docs/examples/uvula_multiple_unsat_2.ofn index c16d1fd16..e0ac20276 100644 --- a/docs/examples/uvula_multiple_unsat_2.ofn +++ b/docs/examples/uvula_multiple_unsat_2.ofn @@ -35,19 +35,19 @@ Declaration(ObjectProperty( (part of) -AnnotationAssertion(rdfs:label "part of"^^xsd:string) +AnnotationAssertion(rdfs:label "part of") # Object Property: (develops_from) -AnnotationAssertion(rdfs:label "develops_from"^^xsd:string) +AnnotationAssertion(rdfs:label "develops_from") # Object Property: (surrounded_by) -AnnotationAssertion(rdfs:label "surrounded_by"^^xsd:string) +AnnotationAssertion(rdfs:label "surrounded_by") # Object Property: (composed primarily of) -AnnotationAssertion(rdfs:label "composed primarily of"^^xsd:string) +AnnotationAssertion(rdfs:label "composed primarily of") # Object Property: (synapsed by) @@ -65,68 +65,68 @@ AnnotationAssertion(rdfs:label "moto # Class: (tissue) -AnnotationAssertion(rdfs:label "tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "tissue") SubClassOf( ) # Class: (skeletal muscle tissue) -AnnotationAssertion(rdfs:label "skeletal muscle tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "skeletal muscle tissue") SubClassOf( ObjectSomeValuesFrom( )) # Class: (muscle organ) -AnnotationAssertion(rdfs:label "muscle organ"^^xsd:string) +AnnotationAssertion(rdfs:label "muscle organ") # Class: (soft palate) -AnnotationAssertion(rdfs:label "soft palate"^^xsd:string) +AnnotationAssertion(rdfs:label "soft palate") # Class: (connective tissue) -AnnotationAssertion(rdfs:label "connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "connective tissue") SubClassOf( ) # Class: (myotome) -AnnotationAssertion(rdfs:label "myotome"^^xsd:string) +AnnotationAssertion(rdfs:label "myotome") # Class: (palatal muscle) -AnnotationAssertion(rdfs:label "palatal muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "palatal muscle") EquivalentClasses( ObjectIntersectionOf( ObjectSomeValuesFrom( ))) # Class: (multicellular anatomical structure) -AnnotationAssertion(rdfs:label "multicellular anatomical structure"^^xsd:string) +AnnotationAssertion(rdfs:label "multicellular anatomical structure") # Class: (irregular connective tissue) -AnnotationAssertion(rdfs:label "irregular connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "irregular connective tissue") SubClassOf( ) # Class: (dense irregular connective tissue) -AnnotationAssertion(rdfs:label "dense irregular connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "dense irregular connective tissue") SubClassOf( ) SubClassOf( ) # Class: (dense connective tissue) -AnnotationAssertion(rdfs:label "dense connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "dense connective tissue") # Class: (epimysium) -AnnotationAssertion(rdfs:label "epimysium"^^xsd:string) +AnnotationAssertion(rdfs:label "epimysium") SubClassOf( ) # Class: (skeletal muscle organ) -AnnotationAssertion(rdfs:label "skeletal muscle organ"^^xsd:string) +AnnotationAssertion(rdfs:label "skeletal muscle organ") EquivalentClasses( ObjectIntersectionOf( ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ))) # Class: (developing mesenchymal structure) -AnnotationAssertion(rdfs:label "developing mesenchymal structure"^^xsd:string) +AnnotationAssertion(rdfs:label "developing mesenchymal structure") DisjointClasses( ) diff --git a/docs/examples/uvula_multiple_unsat_all_explanation.ofn b/docs/examples/uvula_multiple_unsat_all_explanation.ofn index 3359bfd3b..1e62b47b5 100644 --- a/docs/examples/uvula_multiple_unsat_all_explanation.ofn +++ b/docs/examples/uvula_multiple_unsat_all_explanation.ofn @@ -36,19 +36,19 @@ Declaration(ObjectProperty( (part of) -AnnotationAssertion(rdfs:label "part of"^^xsd:string) +AnnotationAssertion(rdfs:label "part of") # Object Property: (develops_from) -AnnotationAssertion(rdfs:label "develops_from"^^xsd:string) +AnnotationAssertion(rdfs:label "develops_from") # Object Property: (surrounded_by) -AnnotationAssertion(rdfs:label "surrounded_by"^^xsd:string) +AnnotationAssertion(rdfs:label "surrounded_by") # Object Property: (composed primarily of) -AnnotationAssertion(rdfs:label "composed primarily of"^^xsd:string) +AnnotationAssertion(rdfs:label "composed primarily of") # Object Property: (synapsed by) @@ -66,74 +66,74 @@ AnnotationAssertion(rdfs:label "moto # Class: (tissue) -AnnotationAssertion(rdfs:label "tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "tissue") SubClassOf( ) # Class: (skeletal muscle tissue) -AnnotationAssertion(rdfs:label "skeletal muscle tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "skeletal muscle tissue") SubClassOf( ObjectSomeValuesFrom( )) # Class: (muscle organ) -AnnotationAssertion(rdfs:label "muscle organ"^^xsd:string) +AnnotationAssertion(rdfs:label "muscle organ") # Class: (soft palate) -AnnotationAssertion(rdfs:label "soft palate"^^xsd:string) +AnnotationAssertion(rdfs:label "soft palate") # Class: (connective tissue) -AnnotationAssertion(rdfs:label "connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "connective tissue") SubClassOf( ) # Class: (myotome) -AnnotationAssertion(rdfs:label "myotome"^^xsd:string) +AnnotationAssertion(rdfs:label "myotome") # Class: (palatal muscle) -AnnotationAssertion(rdfs:label "palatal muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "palatal muscle") EquivalentClasses( ObjectIntersectionOf( ObjectSomeValuesFrom( ))) DisjointClasses( ) # Class: (multicellular anatomical structure) -AnnotationAssertion(rdfs:label "multicellular anatomical structure"^^xsd:string) +AnnotationAssertion(rdfs:label "multicellular anatomical structure") # Class: (uvular muscle) -AnnotationAssertion(rdfs:label "uvular muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "uvular muscle") SubClassOf( ) # Class: (irregular connective tissue) -AnnotationAssertion(rdfs:label "irregular connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "irregular connective tissue") SubClassOf( ) # Class: (dense irregular connective tissue) -AnnotationAssertion(rdfs:label "dense irregular connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "dense irregular connective tissue") SubClassOf( ) SubClassOf( ) # Class: (dense connective tissue) -AnnotationAssertion(rdfs:label "dense connective tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "dense connective tissue") # Class: (epimysium) -AnnotationAssertion(rdfs:label "epimysium"^^xsd:string) +AnnotationAssertion(rdfs:label "epimysium") SubClassOf( ) # Class: (skeletal muscle organ) -AnnotationAssertion(rdfs:label "skeletal muscle organ"^^xsd:string) +AnnotationAssertion(rdfs:label "skeletal muscle organ") EquivalentClasses( ObjectIntersectionOf( ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ))) # Class: (developing mesenchymal structure) -AnnotationAssertion(rdfs:label "developing mesenchymal structure"^^xsd:string) +AnnotationAssertion(rdfs:label "developing mesenchymal structure") DisjointClasses( ) diff --git a/docs/examples/uvular_muscle.ofn b/docs/examples/uvular_muscle.ofn index 1e7203e4e..b3fa033af 100644 --- a/docs/examples/uvular_muscle.ofn +++ b/docs/examples/uvular_muscle.ofn @@ -7,7 +7,7 @@ Prefix(rdfs:=) Ontology( -Annotation(rdfs:label "Uvular Muscle Explanation"^^xsd:string) +Annotation(rdfs:label "Uvular Muscle Explanation") Declaration(Class()) Declaration(Class()) @@ -33,20 +33,20 @@ Declaration(ObjectProperty( (part of) -AnnotationAssertion(rdfs:label "part of"^^xsd:string) +AnnotationAssertion(rdfs:label "part of") TransitiveObjectProperty() # Object Property: (develops_from) -AnnotationAssertion(rdfs:label "develops_from"^^xsd:string) +AnnotationAssertion(rdfs:label "develops_from") # Object Property: (surrounded_by) -AnnotationAssertion(rdfs:label "surrounded_by"^^xsd:string) +AnnotationAssertion(rdfs:label "surrounded_by") # Object Property: (composed primarily of) -AnnotationAssertion(rdfs:label "composed primarily of"^^xsd:string) +AnnotationAssertion(rdfs:label "composed primarily of") # Object Property: (synapsed by) @@ -64,52 +64,52 @@ AnnotationAssertion(rdfs:label "moto # Class: (skeletal muscle tissue) -AnnotationAssertion(rdfs:label "skeletal muscle tissue"^^xsd:string) +AnnotationAssertion(rdfs:label "skeletal muscle tissue") # Class: (muscle organ) -AnnotationAssertion(rdfs:label "muscle organ"^^xsd:string) +AnnotationAssertion(rdfs:label "muscle organ") # Class: (upper jaw region) -AnnotationAssertion(rdfs:label "upper jaw region"^^xsd:string) +AnnotationAssertion(rdfs:label "upper jaw region") SubClassOf( ObjectSomeValuesFrom( )) # Class: (secondary palate) -AnnotationAssertion(rdfs:label "secondary palate"^^xsd:string) +AnnotationAssertion(rdfs:label "secondary palate") SubClassOf( ObjectSomeValuesFrom( )) # Class: (soft palate) -AnnotationAssertion(rdfs:label "soft palate"^^xsd:string) +AnnotationAssertion(rdfs:label "soft palate") SubClassOf( ObjectSomeValuesFrom( )) # Class: (myotome) -AnnotationAssertion(rdfs:label "myotome"^^xsd:string) +AnnotationAssertion(rdfs:label "myotome") # Class: (palatal muscle) -AnnotationAssertion(rdfs:label "palatal muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "palatal muscle") EquivalentClasses( ObjectIntersectionOf( ObjectSomeValuesFrom( ))) # Class: (uvular muscle) -AnnotationAssertion(rdfs:label "uvular muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "uvular muscle") SubClassOf( ) # Class: (jaw region) -AnnotationAssertion(rdfs:label "jaw region"^^xsd:string) +AnnotationAssertion(rdfs:label "jaw region") # Class: (epimysium) -AnnotationAssertion(rdfs:label "epimysium"^^xsd:string) +AnnotationAssertion(rdfs:label "epimysium") # Class: (skeletal muscle organ) -AnnotationAssertion(rdfs:label "skeletal muscle organ"^^xsd:string) +AnnotationAssertion(rdfs:label "skeletal muscle organ") EquivalentClasses( ObjectIntersectionOf( ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ) ObjectSomeValuesFrom( ))) diff --git a/docs/examples/uvular_unsat_explanation.ofn b/docs/examples/uvular_unsat_explanation.ofn index 0d8baeea2..dcdf62700 100644 --- a/docs/examples/uvular_unsat_explanation.ofn +++ b/docs/examples/uvular_unsat_explanation.ofn @@ -7,7 +7,7 @@ Prefix(rdfs:=) Ontology( -Annotation(rdfs:label "Explanation for unsatisfiability of Uvular Muscle"^^xsd:string) +Annotation(rdfs:label "Explanation for unsatisfiability of Uvular Muscle") Declaration(Class()) Declaration(Class()) @@ -19,12 +19,12 @@ Declaration(Class()) # Class: (palatal muscle) -AnnotationAssertion(rdfs:label "palatal muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "palatal muscle") DisjointClasses( ) # Class: (uvular muscle) -AnnotationAssertion(rdfs:label "uvular muscle"^^xsd:string) +AnnotationAssertion(rdfs:label "uvular muscle") SubClassOf( ) diff --git a/pom.xml b/pom.xml index 293e1a788..3177e012d 100644 --- a/pom.xml +++ b/pom.xml @@ -165,7 +165,7 @@ net.sourceforge.owlapi owlapi-api - 4.5.6 + 4.5.24 com.google.code.findbugs @@ -176,7 +176,7 @@ net.sourceforge.owlapi owlapi-apibinding - 4.5.6 + 4.5.24 com.google.code.findbugs @@ -187,7 +187,7 @@ net.sourceforge.owlapi owlapi-rio - 4.5.6 + 4.5.24 com.google.code.findbugs diff --git a/robot-command/src/test/java/org/obolibrary/robot/CommandLineIT.java b/robot-command/src/test/java/org/obolibrary/robot/CommandLineIT.java index 0b2941d92..2412a89ce 100644 --- a/robot-command/src/test/java/org/obolibrary/robot/CommandLineIT.java +++ b/robot-command/src/test/java/org/obolibrary/robot/CommandLineIT.java @@ -81,8 +81,8 @@ private List extractCommands(File docFile) throws IOException { } /** - * Ensure that the examples/results/ directory exists and is empty, - * and that the `target/integration-tests.txt` file is deleted. + * Ensure that the examples/results/ directory exists and is empty, and that the + * `target/integration-tests.txt` file is deleted. * * @throws Exception if directory cannot be created or emptied */ diff --git a/robot-core/pom.xml b/robot-core/pom.xml index 5b01797e1..96fe572ce 100644 --- a/robot-core/pom.xml +++ b/robot-core/pom.xml @@ -58,6 +58,11 @@ + + + + org.openrdf.rio.* + @@ -81,7 +86,7 @@ net.sourceforge.owlapi owlapi-api - 4.5.6 + 4.5.24 com.google.code.findbugs @@ -92,7 +97,7 @@ net.sourceforge.owlapi owlapi-apibinding - 4.5.6 + 4.5.24 com.google.code.findbugs @@ -103,7 +108,7 @@ net.sourceforge.owlapi owlapi-rio - 4.5.6 + 4.5.24 com.google.code.findbugs diff --git a/robot-core/src/main/java/org/obolibrary/robot/ExpandOperation.java b/robot-core/src/main/java/org/obolibrary/robot/ExpandOperation.java index 14f1220be..cdd019853 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/ExpandOperation.java +++ b/robot-core/src/main/java/org/obolibrary/robot/ExpandOperation.java @@ -10,7 +10,7 @@ import org.apache.jena.rdf.model.ResourceFactory; import org.apache.jena.vocabulary.OWL; import org.apache.jena.vocabulary.RDF; -import org.openrdf.model.vocabulary.DCTERMS; +import org.eclipse.rdf4j.model.vocabulary.DCTERMS; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.model.*; import org.semanticweb.owlapi.model.parameters.Imports; diff --git a/robot-core/src/main/java/org/obolibrary/robot/QueryOperation.java b/robot-core/src/main/java/org/obolibrary/robot/QueryOperation.java index 92edce3fb..9362530cc 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/QueryOperation.java +++ b/robot-core/src/main/java/org/obolibrary/robot/QueryOperation.java @@ -17,11 +17,10 @@ import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.sparql.core.DatasetGraphFactory; import org.apache.jena.update.UpdateAction; -import org.openrdf.model.BNode; -import org.openrdf.model.Literal; -import org.openrdf.model.Statement; -import org.openrdf.model.URI; -import org.openrdf.rio.RDFHandler; +import org.eclipse.rdf4j.model.BNode; +import org.eclipse.rdf4j.model.Literal; +import org.eclipse.rdf4j.model.Statement; +import org.eclipse.rdf4j.rio.RDFHandler; import org.semanticweb.owlapi.apibinding.OWLManager; import org.semanticweb.owlapi.formats.TurtleDocumentFormat; import org.semanticweb.owlapi.model.*; @@ -170,12 +169,13 @@ public void handleStatement(Statement triple) { object = new ResourceImpl( new AnonId(modelUniqueBlankNodePrefix + ((BNode) triple.getObject()).getID())); - } else if (triple.getObject() instanceof URI) { + } else if (triple.getObject() instanceof org.eclipse.rdf4j.model.IRI) { object = ResourceFactory.createResource(triple.getObject().stringValue()); } else { Literal literal = (Literal) (triple.getObject()); - if (literal.getLanguage() != null) { - object = ResourceFactory.createLangLiteral(literal.getLabel(), literal.getLanguage()); + if (literal.getLanguage().isPresent()) { + object = + ResourceFactory.createLangLiteral(literal.getLabel(), literal.getLanguage().get()); } else if (literal.getDatatype() != null) { object = ResourceFactory.createTypedLiteral( diff --git a/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java b/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java index 0c2b9f565..dc81dc6f1 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java +++ b/robot-core/src/main/java/org/obolibrary/robot/QuotedEntityChecker.java @@ -389,10 +389,15 @@ public OWLDataProperty getOWLDataProperty(@Nonnull String name) { if (iri != null) { return dataFactory.getOWLDataProperty(iri); } - if (ioHelper != null) { - iri = ioHelper.createIRI(name); - if (iri != null) { - return dataFactory.getOWLDataProperty(iri); + // prevent punning + if (!objectProperties.containsKey(name)) { + if (ioHelper != null) { + iri = ioHelper.createIRI(name); + if (iri != null) { + OWLDataProperty owlDataProperty = dataFactory.getOWLDataProperty(iri); + dataProperties.put(name, iri); + return owlDataProperty; + } } } return null; @@ -465,10 +470,15 @@ public OWLObjectProperty getOWLObjectProperty(@Nonnull String name) { if (iri != null) { return dataFactory.getOWLObjectProperty(iri); } - if (ioHelper != null) { - iri = ioHelper.createIRI(name); - if (iri != null) { - return dataFactory.getOWLObjectProperty(iri); + // prevent punning + if (!dataProperties.containsKey(name)) { + if (ioHelper != null) { + iri = ioHelper.createIRI(name); + if (iri != null) { + OWLObjectProperty owlObjectProperty = dataFactory.getOWLObjectProperty(iri); + objectProperties.put(name, iri); + return owlObjectProperty; + } } } return null; diff --git a/robot-core/src/main/java/org/obolibrary/robot/metrics/OntologyMetrics.java b/robot-core/src/main/java/org/obolibrary/robot/metrics/OntologyMetrics.java index dc643e428..f9d04e673 100644 --- a/robot-core/src/main/java/org/obolibrary/robot/metrics/OntologyMetrics.java +++ b/robot-core/src/main/java/org/obolibrary/robot/metrics/OntologyMetrics.java @@ -46,6 +46,7 @@ import org.semanticweb.owlapi.profiles.OWLProfileReport; import org.semanticweb.owlapi.profiles.OWLProfileViolation; import org.semanticweb.owlapi.reasoner.OWLReasoner; +import org.semanticweb.owlapi.util.Construct; import org.semanticweb.owlapi.util.DLExpressivityChecker; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -1007,7 +1008,7 @@ private Set getConstructs(boolean includeImportsClosure) { } DLExpressivityChecker checker = new DLExpressivityChecker(onts); Set constructs = new HashSet<>(); - for (DLExpressivityChecker.Construct c : checker.getConstructs()) { + for (Construct c : checker.getConstructs()) { constructs.add(c.name()); } return constructs; diff --git a/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java b/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java index 1550b0b48..4324753f4 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/IOHelperTest.java @@ -324,7 +324,15 @@ public void testStrict() throws IOException { IOHelper ioHelper = new IOHelper(); ioHelper.setStrict(true); String input = - "@prefix rdf: .\n\n_:Bb65616 rdf:type rdf:Statement ."; + "@prefix rdf: ." + .concat("\n\n") + .concat("@prefix foo: .") + .concat("\n\n") + .concat("_:Bb65616 rdf:type rdf:Statement ;") + .concat("\n\n") + .concat("rdf:object foo:Bar ;") + .concat("\n\n") + .concat("rdf:subject foo:Foo ."); InputStream inputStream = new ByteArrayInputStream(input.getBytes()); boolean pass = false; try { diff --git a/robot-core/src/test/java/org/obolibrary/robot/MeasureOperationTest.java b/robot-core/src/test/java/org/obolibrary/robot/MeasureOperationTest.java index dc9a3ef11..f7847c384 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/MeasureOperationTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/MeasureOperationTest.java @@ -47,7 +47,7 @@ public void testExtendedMetrics() throws IOException { MeasureResult result = MeasureOperation.getMetrics( ontology, "extended", new CURIEShortFormProvider(new IOHelper().getPrefixes())); - assertEquals("SI(D)", result.getSimpleMetricValue(MetricsLabels.EXPRESSIVITY)); + assertEquals("RRESTRUCINTE+I(D)", result.getSimpleMetricValue(MetricsLabels.EXPRESSIVITY)); } /** 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 a46266cd6..2c387a018 100644 --- a/robot-core/src/test/java/org/obolibrary/robot/ReasonOperationTest.java +++ b/robot-core/src/test/java/org/obolibrary/robot/ReasonOperationTest.java @@ -284,7 +284,7 @@ public void testClassAxiomGenerators() throws Exception { assertTrue( checkContains( ontology, - "EquivalentClasses( )")); + "EquivalentClasses( )")); // disjoint classes assertTrue( @@ -317,7 +317,7 @@ public void testObjectPropertyAxiomGenerators() throws Exception { assertTrue( checkContains( ontology, - "EquivalentObjectProperties( )")); + "EquivalentObjectProperties( )")); // inverse properties assertTrue( checkContains( @@ -348,7 +348,7 @@ public void testDataPropertyAxiomGenerators() throws Exception { assertTrue( checkContains( ontology, - "EquivalentDataProperties( )")); + "EquivalentDataProperties( )")); } /**