├── docs ├── CNAME ├── examples │ ├── cell_part_ask.txt │ ├── foo.json │ ├── individuals.csv │ ├── uberon_module.txt │ ├── partial-rename.tsv │ ├── README.md │ ├── merged-validation.txt │ ├── fbcv-remove.txt │ ├── annotated.obo.gz │ ├── source-map.tsv │ ├── full-rename.tsv │ ├── part_of_template.csv │ ├── parts.txt │ ├── terms.txt │ ├── bar.json │ ├── uvula_multiple_list.txt │ ├── cell_part.csv │ ├── my-profile.txt │ ├── missing-rename.tsv │ ├── asserted-equiv.owl │ ├── catalog-diff.txt │ ├── named_graph.sparql │ ├── catalog-right.xml │ ├── catalog.xml │ ├── part_of.ttl │ ├── cell_part_ask.sparql │ ├── my-report.tsv │ ├── missing-contributor.sparql │ ├── annotations.ttl │ ├── cell_part.sparql │ ├── xref-repaired.obo │ ├── xref-need-of-repair.obo │ ├── equivalent.sparql │ ├── update.ru │ ├── inferred-equiv.owl │ ├── subset.obo │ ├── uvula_multiple_list.ofn │ ├── release-diff.txt │ ├── nucleus-ids.csv │ ├── uberon_template.csv │ ├── part_of.sparql │ ├── my-catalog.xml │ ├── revert.ru │ ├── template.csv │ ├── foo.owl │ ├── edit2.owl │ ├── merge.owl │ ├── imports.owl │ ├── imports-right.owl │ ├── nucleus.csv │ ├── imports-nucleus.owl │ ├── uvula_inconsistent_explanation.md │ ├── named_graph.csv │ ├── my-base-report.tsv │ ├── nucleus-reversed.csv │ ├── nucleus-sorted.csv │ ├── uvular_unsat_explanation.ofn │ ├── mitochondrion.owl │ ├── metrics_essential.json │ ├── metrics.tsv │ ├── metrics_essential_reasoner.json │ ├── classes-properties.csv │ ├── nucleus-iris.csv │ ├── errors.csv │ └── no-tautologies.owl ├── _config.yml ├── report_queries │ ├── illegal_use_of_built_in_vocabulary.md │ ├── invalid_xref.md │ ├── misused_replaced_by.md │ ├── deprecated_boolean_datatype.md │ ├── equivalent_pair.md │ ├── missing_obsolete_label.md │ ├── missing_subset_declaration.md │ ├── missing_ontology_license.md │ ├── missing_ontology_title.md │ ├── multiple_equivalent_class_definitions.md │ ├── missing_synonymtype_declaration.md │ ├── missing_ontology_description.md │ ├── lowercase_definition.md │ ├── annotation_whitespace.md │ ├── label_formatting.md │ ├── label_whitespace.md │ ├── multiple_labels.md │ ├── misused_obsolete_label.md │ ├── multiple_equivalent_classes.md │ ├── duplicate_label.md │ ├── multiple_definitions.md │ ├── duplicate_label_synonym.md │ ├── equivalent_class_axiom_no_genus.md │ ├── invalid_entity_uri.md │ ├── duplicate_definition.md │ ├── duplicate_exact_synonym.md │ ├── duplicate_scoped_synonym.md │ ├── missing_superclass.md │ ├── multiple_asserted_superclasses.md │ ├── missing_label.md │ ├── missing_definition.md │ └── deprecated_property_reference.md ├── mirror.md ├── reduce.md ├── unmerge.md ├── materialize.md ├── export-prefixes.md ├── chaining.md ├── validate-profile.md ├── repair.md └── Makefile ├── bin ├── robot.bat └── robot ├── images ├── cyclic-import-chain-1.png ├── cyclic-import-chain-2.png └── cyclic-import-chain-3.png ├── robot-core └── src │ ├── test │ ├── resources │ │ ├── template-labels.csv │ │ ├── template-ids.csv │ │ ├── template-individual-split.csv │ │ ├── 1030-input-iri-catalog │ │ │ ├── test-imported.owl │ │ │ └── catalog-v001.xml │ │ ├── inconsistent.owl │ │ ├── incoherent-tbox.owl │ │ ├── mat_reflexivity_test.obo │ │ ├── simple.diff │ │ ├── mat_reflexivity_test_materialized.obo │ │ ├── asserted-equiv.owl │ │ ├── equiv_reduce_test.obo │ │ ├── equiv_reduce_test_reduced.obo │ │ ├── reduce_gci_reduced.obo │ │ ├── intersection.omn │ │ ├── incoherent-rbox.owl │ │ ├── non-reasoned.owl │ │ ├── reduce-domain-test.owl │ │ ├── reduce_gci_test.obo │ │ ├── reduce_reflexivity_test_reduced.obo │ │ ├── reduce_reflexivity_test.obo │ │ ├── xref-repaired.obo │ │ ├── xref-need-of-repair.obo │ │ ├── inferred-equiv.owl │ │ ├── subset.obo │ │ ├── legacy-template-logical.csv │ │ ├── import-non-reasoned.owl │ │ ├── template-logical.csv │ │ ├── legacy-template.csv │ │ ├── simple1.diff │ │ ├── redundant_expr_reduced.obo │ │ ├── 1016-report-json-failure │ │ │ ├── input.owl │ │ │ ├── output.yaml │ │ │ └── output.json │ │ ├── template.csv │ │ ├── import_test.owl │ │ ├── simple.yaml │ │ ├── redundant_expr.obo │ │ ├── docs-template.csv │ │ ├── reason_exclude_tautologies.ofn │ │ ├── empty.owl │ │ ├── simple.json │ │ ├── relax_equivalence_axioms_expressions_materialized.obo │ │ ├── 1017-empty-label-input.owl │ │ ├── relax_equivalence_axioms_test.obo │ │ ├── simple_parts_unmerged.owl │ │ ├── relax_equivalence_axioms_relaxed.obo │ │ ├── gci_example.obo │ │ ├── reason-direct-indirect.ofn │ │ ├── rename_partial.owl │ │ ├── gci_example_materialized.obo │ │ ├── simple_filtered.owl │ │ ├── rename_full.owl │ │ ├── pH-extract.ttl │ │ ├── simple.owl │ │ └── simple_update.owl │ └── java │ │ └── org │ │ └── obolibrary │ │ └── robot │ │ ├── RelaxOperationTest.java │ │ ├── UnmergeOperationTest.java │ │ ├── RenameOperationTest.java │ │ ├── CURIEShortFormProviderTest.java │ │ └── RepairOperationTest.java │ └── main │ ├── java │ └── org │ │ └── obolibrary │ │ └── robot │ │ ├── exceptions │ │ ├── package-info.java │ │ ├── CannotReadQuery.java │ │ ├── InconsistentOntologyException.java │ │ ├── OntologyStructureException.java │ │ ├── IncoherentRBoxException.java │ │ ├── IncoherentTBoxException.java │ │ ├── InvalidReferenceException.java │ │ ├── ColumnException.java │ │ ├── OntologyLogicException.java │ │ └── RowParseException.java │ │ ├── export │ │ └── RendererType.java │ │ ├── reason │ │ ├── EquivalentAxiomReasoningTest.java │ │ ├── InferredClassAssertionAxiomGeneratorDirectOnly.java │ │ ├── InferredObjectPropertyRangeAxiomGenerator.java │ │ ├── InferredObjectPropertyDomainAxiomGenerator.java │ │ ├── InferredSubClassAxiomGeneratorIncludingIndirect.java │ │ └── InferredSubObjectPropertyAxiomGeneratorIncludingIndirect.java │ │ ├── providers │ │ ├── IRIValueShortFormProvider.java │ │ ├── EmptyIRIShortFormProvider.java │ │ └── EmptyShortFormProvider.java │ │ └── PythonOperation.java │ └── resources │ ├── logback.xml │ ├── report_queries │ ├── illegal_use_of_built_in_vocabulary.rq │ ├── invalid_xref.rq │ ├── misused_replaced_by.rq │ ├── deprecated_boolean_datatype.rq │ ├── equivalent_pair.rq │ ├── missing_obsolete_label.rq │ ├── missing_ontology_title.rq │ ├── missing_ontology_license.rq │ ├── missing_subset_declaration.rq │ ├── multiple_equivalent_class_definitions.rq │ ├── missing_synonymtype_declaration.rq │ ├── missing_ontology_description.rq │ ├── lowercase_definition.rq │ ├── annotation_whitespace.rq │ ├── label_formatting.rq │ ├── label_whitespace.rq │ ├── multiple_labels.rq │ ├── misused_obsolete_label.rq │ ├── invalid_entity_uri.rq │ ├── multiple_equivalent_classes.rq │ ├── duplicate_label.rq │ ├── duplicate_label_synonym.rq │ ├── multiple_definitions.rq │ ├── equivalent_class_axiom_no_genus.rq │ ├── duplicate_definition.rq │ ├── duplicate_exact_synonym.rq │ ├── duplicate_scoped_synonym.rq │ ├── missing_superclass.rq │ ├── multiple_asserted_superclasses.rq │ ├── missing_label.rq │ ├── missing_definition.rq │ └── deprecated_property_reference.rq │ ├── blazegraph.properties │ ├── report_profile.txt │ ├── validate-table-template.jinja2 │ └── validate-template.jinja2 ├── AUTHORS.md ├── .gitignore ├── .github ├── pull_request_template.md └── workflows │ └── java-ci.yml ├── .editorconfig ├── Dockerfile ├── robot-command └── src │ ├── main │ ├── resources │ │ └── logback.xml │ └── java │ │ └── org │ │ └── obolibrary │ │ └── robot │ │ ├── ExtendedPosixParser.java │ │ ├── Command.java │ │ └── CommandState.java │ └── test │ └── java │ └── org │ └── obolibrary │ └── robot │ └── CommandLineHelperTest.java ├── util └── check_docs.py ├── LICENSE.txt ├── Jenkinsfile └── robot-maven-plugin └── README.md /docs/CNAME: -------------------------------------------------------------------------------- 1 | robot.obolibrary.org -------------------------------------------------------------------------------- /docs/examples/cell_part_ask.txt: -------------------------------------------------------------------------------- 1 | true -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-minimal -------------------------------------------------------------------------------- /bin/robot.bat: -------------------------------------------------------------------------------- 1 | java %ROBOT_JAVA_ARGS% -jar %~dp0robot.jar %* 2 | -------------------------------------------------------------------------------- /docs/examples/foo.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context" : { 3 | "foo" : "http://foo#" 4 | } 5 | } -------------------------------------------------------------------------------- /docs/examples/individuals.csv: -------------------------------------------------------------------------------- 1 | ID,LABEL,Type 2 | example:rat-1234,rat 1234,F 344/N 3 | -------------------------------------------------------------------------------- /docs/examples/uberon_module.txt: -------------------------------------------------------------------------------- 1 | http://purl.obolibrary.org/obo/UBERON_0001235 # adrenal cortex 2 | -------------------------------------------------------------------------------- /docs/examples/partial-rename.tsv: -------------------------------------------------------------------------------- 1 | Old IRI New IRI 2 | http://purl.obolibrary.org/obo/ http://foo.bar/ -------------------------------------------------------------------------------- /docs/examples/README.md: -------------------------------------------------------------------------------- 1 | Please see http://robot.obolibrary.org/ for examples and further documentation. 2 | -------------------------------------------------------------------------------- /docs/examples/merged-validation.txt: -------------------------------------------------------------------------------- 1 | OWL 2 EL Profile Report: [Ontology and imports closure in profile] 2 | -------------------------------------------------------------------------------- /docs/examples/fbcv-remove.txt: -------------------------------------------------------------------------------- 1 | obo:FBcv_0000002 2 | obo:FBcv_0000683 3 | obo:IAO_0000115 4 | oboInOwl:hasDbXref -------------------------------------------------------------------------------- /docs/examples/annotated.obo.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timowness-m4-5/robot-1/HEAD/docs/examples/annotated.obo.gz -------------------------------------------------------------------------------- /docs/examples/source-map.tsv: -------------------------------------------------------------------------------- 1 | term source 2 | UBERON:0000916 http://purl.obolibrary.org/obo/go.owl 3 | UBERON:0001062 GO -------------------------------------------------------------------------------- /docs/examples/full-rename.tsv: -------------------------------------------------------------------------------- 1 | Old IRI new IRI 2 | obo:BFO_0000051 fb:BFO_1234567 3 | obo:BFO_0000054 fb:BFO_7654321 4 | -------------------------------------------------------------------------------- /images/cyclic-import-chain-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timowness-m4-5/robot-1/HEAD/images/cyclic-import-chain-1.png -------------------------------------------------------------------------------- /images/cyclic-import-chain-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timowness-m4-5/robot-1/HEAD/images/cyclic-import-chain-2.png -------------------------------------------------------------------------------- /images/cyclic-import-chain-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/timowness-m4-5/robot-1/HEAD/images/cyclic-import-chain-3.png -------------------------------------------------------------------------------- /docs/examples/part_of_template.csv: -------------------------------------------------------------------------------- 1 | ID,Label,Part 2 | ID,LABEL,SC part_of some % 3 | UBERON:123,new system,endocrine system 4 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/template-labels.csv: -------------------------------------------------------------------------------- 1 | Label,Synonyms 2 | LABEL,A IAO:0000118 SPLIT=| 3 | test 3,synonym 1|synonym 2 4 | -------------------------------------------------------------------------------- /docs/examples/parts.txt: -------------------------------------------------------------------------------- 1 | http://purl.obolibrary.org/obo/BFO_0000050 # part of 2 | http://purl.obolibrary.org/obo/BFO_0000051 # has part 3 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/template-ids.csv: -------------------------------------------------------------------------------- 1 | Label,ID 2 | A rdfs:label,ID 3 | skip this row 4 | test 3,GO:1234 5 | test 4,GO:1235 6 | -------------------------------------------------------------------------------- /docs/examples/terms.txt: -------------------------------------------------------------------------------- 1 | http://purl.obolibrary.org/obo/BFO_0000002 # continuant 2 | http://purl.obolibrary.org/obo/BFO_0000050 # part of 3 | -------------------------------------------------------------------------------- /docs/examples/bar.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context" : { 3 | "foo" : "http://foo#", 4 | "bar" : "http://bar#", 5 | "baz" : "http://baz#" 6 | } 7 | } -------------------------------------------------------------------------------- /docs/examples/uvula_multiple_list.txt: -------------------------------------------------------------------------------- 1 | UBERON:0001134 2 | UBERON:0003682 3 | UBERON:0010235 4 | UBERON:0011822 5 | UBERON:0011899 6 | UBERON:0014892 7 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/package-info.java: -------------------------------------------------------------------------------- 1 | /** */ 2 | /** @author cjm */ 3 | package org.obolibrary.robot.exceptions; 4 | -------------------------------------------------------------------------------- /docs/examples/cell_part.csv: -------------------------------------------------------------------------------- 1 | class,label 2 | http://purl.obolibrary.org/obo/GO_0005622,intracellular 3 | http://purl.obolibrary.org/obo/GO_0044424,intracellular part 4 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/template-individual-split.csv: -------------------------------------------------------------------------------- 1 | ID,Entity Type,Synonyms 2 | ID,TYPE,A IAO:0000118 SPLIT=| 3 | ex:indv_1,owl:NamedIndividual,synonym 1|synonym 2 -------------------------------------------------------------------------------- /docs/examples/my-profile.txt: -------------------------------------------------------------------------------- 1 | WARN annotation_whitespace 2 | ERROR invalid_xref 3 | ERROR label_formatting 4 | INFO file:missing-contributor.sparql 5 | ERROR multiple_labels 6 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/1030-input-iri-catalog/test-imported.owl: -------------------------------------------------------------------------------- 1 | @prefix owl: . 2 | a owl:Ontology . -------------------------------------------------------------------------------- /docs/examples/missing-rename.tsv: -------------------------------------------------------------------------------- 1 | Old IRI New IRI New Label 2 | obo:BFO_0000051 fb:BFO_1234567 foo bar 3 | obo:BFO_0000054 fb:BFO_7654321 foo baz 4 | obo:BFO_0000017 fb:BFO_0000000 5 | -------------------------------------------------------------------------------- /AUTHORS.md: -------------------------------------------------------------------------------- 1 | ## Authors 2 | 3 | To see the list of contributors, please check the [contributors](https://github.com/ontodev/robot/graphs/contributors) page on GitHub. 4 | 5 | For full acknowledgments, see [README.md](README.md) 6 | 7 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/inconsistent.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | 3 | Ontology: 4 | 5 | Class: C 6 | Class: O 7 | DisjointWith: C 8 | 9 | Individual: I 10 | Types: C 11 | Types: O 12 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/incoherent-tbox.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | 3 | Ontology: 4 | 5 | Class: C 6 | Class: O 7 | DisjointWith: C 8 | 9 | Class: D 10 | SubClassOf: C 11 | SubClassOf: O 12 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/mat_reflexivity_test.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:2 5 | name: x2 6 | 7 | [Term] 8 | id: X:1 9 | is_a: X:2 10 | 11 | [Typedef] 12 | id: part_of 13 | xref: BFO:0000050 14 | is_transitive: true 15 | is_reflexive: true 16 | -------------------------------------------------------------------------------- /docs/examples/asserted-equiv.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | 4 | ## A==B 5 | ## Will also trivially infer B==A, but this is the same. 6 | Class: A 7 | EquivalentTo: B 8 | 9 | Class: B 10 | -------------------------------------------------------------------------------- /docs/examples/catalog-diff.txt: -------------------------------------------------------------------------------- 1 | 1 axioms in left ontology but not in right ontology: 2 | - Import() 3 | 4 | 1 axioms in right ontology but not in left ontology: 5 | + Import() 6 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple.diff: -------------------------------------------------------------------------------- 1 | 0 axioms in left ontology but not in right ontology: 2 | 3 | 1 axioms in right ontology but not in left ontology: 4 | + SubClassOf([Test 1] ) 5 | -------------------------------------------------------------------------------- /docs/examples/named_graph.sparql: -------------------------------------------------------------------------------- 1 | PREFIX owl: 2 | 3 | SELECT ?s 4 | FROM NAMED 5 | WHERE { 6 | GRAPH ?g { 7 | ?s a owl:Class . 8 | FILTER (!isBlank(?s)) 9 | } 10 | } 11 | ORDER BY ?s -------------------------------------------------------------------------------- /robot-core/src/test/resources/mat_reflexivity_test_materialized.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:2 5 | name: x2 6 | 7 | [Term] 8 | id: X:1 9 | is_a: X:2 10 | 11 | [Typedef] 12 | id: part_of 13 | xref: BFO:0000050 14 | is_transitive: true 15 | is_reflexive: true 16 | -------------------------------------------------------------------------------- /docs/examples/catalog-right.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/1030-input-iri-catalog/catalog-v001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/asserted-equiv.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | 4 | ## A==B 5 | ## Will also trivially infer B==A, but this is the same. 6 | Class: A 7 | EquivalentTo: B 8 | 9 | Class: B 10 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/equiv_reduce_test.obo: -------------------------------------------------------------------------------- 1 | ontology: redundant_expr 2 | 3 | [Term] 4 | id: X:1 5 | is_a: G:1 6 | relationship: part_of Y:2 7 | intersection_of: G:1 8 | intersection_of: part_of Y:2 9 | 10 | [Typedef] 11 | id: part_of 12 | xref: BFO:0000050 13 | is_transitive: true 14 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/equiv_reduce_test_reduced.obo: -------------------------------------------------------------------------------- 1 | ontology: redundant_expr 2 | 3 | [Term] 4 | id: X:1 5 | is_a: G:1 6 | relationship: part_of Y:2 7 | intersection_of: G:1 8 | intersection_of: part_of Y:2 9 | 10 | [Typedef] 11 | id: part_of 12 | xref: BFO:0000050 13 | is_transitive: true 14 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reduce_gci_reduced.obo: -------------------------------------------------------------------------------- 1 | ontology: redundant_expr 2 | 3 | [Term] 4 | id: NCBITaxon:1 5 | name: example taxon 6 | 7 | [Term] 8 | id: X:1 9 | relationship: part_of X:2 !!! redundant 10 | 11 | [Typedef] 12 | id: part_of 13 | xref: BFO:0000050 14 | is_transitive: true 15 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/intersection.omn: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | 3 | Ontology: 4 | 5 | ## 6 | 7 | Class: A 8 | SubClassOf: B 9 | 10 | Class: B 11 | 12 | Class: X 13 | Class: XA 14 | EquivalentTo: X and A 15 | Class: XB 16 | EquivalentTo: X and B 17 | 18 | 19 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/CannotReadQuery.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | /** Created by edouglass on 8/9/17. */ 4 | public class CannotReadQuery extends RuntimeException { 5 | public CannotReadQuery(String s, Exception e) { 6 | super(s, e); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/incoherent-rbox.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | 3 | Ontology: 4 | 5 | Class: C 6 | Class: O 7 | DisjointWith: C 8 | 9 | ObjectProperty: P 10 | Domain: C 11 | ObjectProperty: Q 12 | Domain: O 13 | SubPropertyOf: P 14 | 15 | 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .classpath 3 | .project 4 | .settings 5 | .idea 6 | *.iml 7 | Gemfile* 8 | bin/original-robot.jar 9 | bin/owltools2.jar 10 | bin/robot.jar 11 | docs/_site/ 12 | docs/examples/catalog-v001.xml 13 | docs/examples/out.owl 14 | docs/examples/results/ 15 | junk/ 16 | target/ 17 | docs/examples/.gradle/ 18 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Resolves [#ISSUE, resolves #ISSUE] 2 | 3 | - [ ] `docs/` have been added/updated 4 | - [ ] tests have been added/updated 5 | - [ ] `mvn verify` says all tests pass 6 | - [ ] `mvn site` says all JavaDocs correct 7 | - [ ] `CHANGELOG.md` has been updated 8 | 9 | [DESCRIPTION, mentioning relevant #ISSUE] 10 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/non-reasoned.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | 4 | ## Test 5 | 6 | ObjectProperty: P 7 | Class: X SubClassOf: Y 8 | Class: Y 9 | 10 | Class: A EquivalentTo: P some X 11 | Class: B EquivalentTo: P some Y 12 | -------------------------------------------------------------------------------- /docs/examples/catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/examples/part_of.ttl: -------------------------------------------------------------------------------- 1 | @prefix owl: . 2 | @prefix rdf: . 3 | @prefix GO: . 4 | @prefix BFO: . 5 | @prefix rdfs: . 6 | 7 | GO:0031981 BFO:0000050 GO:0005634 . 8 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/export/RendererType.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.export; 2 | 3 | /** @author Becky Jackson */ 4 | public enum RendererType { 5 | // Regular manchester renderer 6 | OBJECT_RENDERER, 7 | // Manchester renderer with HTML output 8 | OBJECT_HTML_RENDERER 9 | } 10 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reduce-domain-test.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | 4 | ObjectProperty: supplies Domain: artery 5 | 6 | Class: brain_artery 7 | EquivalentTo: artery and supplies some brain 8 | SubClassOf: artery 9 | SubClassOf: supplies some brain 10 | 11 | Class: artery 12 | Class: brain 13 | -------------------------------------------------------------------------------- /docs/examples/cell_part_ask.sparql: -------------------------------------------------------------------------------- 1 | PREFIX rdfs: 2 | PREFIX rdf: 3 | PREFIX owl: 4 | PREFIX GO: 5 | 6 | ASK { 7 | ?class 8 | rdfs:subClassOf GO:0044464 ; # cell part 9 | rdfs:label ?label . 10 | } 11 | -------------------------------------------------------------------------------- /docs/examples/my-report.tsv: -------------------------------------------------------------------------------- 1 | Level Rule Name Subject Property Value 2 | WARN annotation_whitespace obo:UBPROP_0000007 IAO:0000232 Used to connect a class to an adjectival form of its label. For example, a class with label 'intestine' may have a relational adjective 'intestinal'. 3 | INFO file:missing-contributor https://github.com/ontodev/robot/examples/edit.owl dc11:contributor 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | # An editor-agnostic file format for defining coding styles. 3 | # Eclipse is not yet supported, but many other editors are. 4 | 5 | # Unix-style newlines, indent with four spaces 6 | [*] 7 | charset = utf-8 8 | end_of_line = lf 9 | trim_trailing_whitespace = true 10 | indent_style = space 11 | indent_size = 2 12 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reduce_gci_test.obo: -------------------------------------------------------------------------------- 1 | ontology: redundant_expr 2 | 3 | [Term] 4 | id: NCBITaxon:1 5 | name: example taxon 6 | 7 | [Term] 8 | id: X:1 9 | relationship: part_of X:2 !!! redundant 10 | relationship: part_of X:2 {gci_relation="part_of", gci_filler="NCBITaxon:1"} !!! redundant 11 | 12 | [Typedef] 13 | id: part_of 14 | xref: BFO:0000050 15 | is_transitive: true 16 | -------------------------------------------------------------------------------- /docs/examples/missing-contributor.sparql: -------------------------------------------------------------------------------- 1 | PREFIX dc: 2 | PREFIX dcterms: 3 | PREFIX owl: 4 | 5 | SELECT DISTINCT ?entity ?property ?value WHERE { 6 | ?entity a owl:Ontology . 7 | FILTER NOT EXISTS { 8 | ?entity dc:contributor ?value . 9 | } 10 | BIND(dc:contributor as ?property) 11 | } 12 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reduce_reflexivity_test_reduced.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:1 5 | is_a: X:2 6 | 7 | [Term] 8 | id: X:2 9 | is_a: X:4 10 | relationship: part_of X:3 11 | 12 | [Term] 13 | id: X:3 14 | relationship: part_of X:4 15 | 16 | [Term] 17 | id: X:4 18 | 19 | [Typedef] 20 | id: part_of 21 | xref: BFO:0000050 22 | is_transitive: true 23 | is_reflexive: true 24 | -------------------------------------------------------------------------------- /docs/examples/annotations.ttl: -------------------------------------------------------------------------------- 1 | @prefix rdf: . 2 | @prefix rdfs: . 3 | @prefix owl: . 4 | @prefix example: . 5 | 6 | example:annotated.owl 7 | rdf:type owl:Ontology ; 8 | rdfs:comment "Comment from annotations.ttl file." . 9 | 10 | -------------------------------------------------------------------------------- /docs/examples/cell_part.sparql: -------------------------------------------------------------------------------- 1 | PREFIX rdfs: 2 | PREFIX rdf: 3 | PREFIX owl: 4 | PREFIX GO: 5 | 6 | SELECT ?class ?label 7 | WHERE { 8 | ?class 9 | rdfs:subClassOf GO:0044464 ; # cell part 10 | rdfs:label ?label . 11 | } 12 | ORDER BY ?class 13 | -------------------------------------------------------------------------------- /docs/examples/xref-repaired.obo: -------------------------------------------------------------------------------- 1 | ontology: xref-need-of-repair 2 | 3 | [Term] 4 | id: GO:1 5 | name: leaf node 6 | is_a: GO:3 7 | 8 | [Term] 9 | id: GO:2 10 | name: original parent 11 | is_obsolete: true 12 | replaced_by: GO:3 13 | 14 | [Term] 15 | id: GO:3 16 | name: replacement parent 17 | xref: FOO:1 18 | xref: FOO:2 19 | 20 | [Term] 21 | id: GO:4 22 | name: other term 23 | is_obsolete: true 24 | replaced_by: GO:3 25 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reduce_reflexivity_test.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:1 5 | is_a: X:2 6 | relationship: part_of X:2 7 | 8 | [Term] 9 | id: X:2 10 | is_a: X:4 11 | relationship: part_of X:3 12 | 13 | [Term] 14 | id: X:3 15 | relationship: part_of X:4 16 | 17 | [Term] 18 | id: X:4 19 | 20 | [Typedef] 21 | id: part_of 22 | xref: BFO:0000050 23 | is_transitive: true 24 | is_reflexive: true 25 | -------------------------------------------------------------------------------- /docs/examples/xref-need-of-repair.obo: -------------------------------------------------------------------------------- 1 | ontology: xref-need-of-repair 2 | 3 | [Term] 4 | id: GO:1 5 | name: leaf node 6 | is_a: GO:2 7 | 8 | [Term] 9 | id: GO:2 10 | name: original parent 11 | is_obsolete: true 12 | replaced_by: GO:3 13 | xref: FOO:1 14 | 15 | [Term] 16 | id: GO:3 17 | name: replacement parent 18 | 19 | [Term] 20 | id: GO:4 21 | name: other term 22 | is_obsolete: true 23 | replaced_by: GO:3 24 | xref: FOO:2 25 | -------------------------------------------------------------------------------- /docs/examples/equivalent.sparql: -------------------------------------------------------------------------------- 1 | prefix owl: 2 | prefix rdfs: 3 | 4 | SELECT ?first ?second ?firstLabel ?secondLabel 5 | WHERE { 6 | ?first owl:equivalentClass ?second . 7 | 8 | OPTIONAL {?first rdfs:label ?firstLabel . } 9 | OPTIONAL { ?second rdfs:label ?secondLabel . } 10 | 11 | FILTER (!isBlank(?first)) 12 | FILTER (!isBlank(?second)) 13 | } -------------------------------------------------------------------------------- /docs/examples/update.ru: -------------------------------------------------------------------------------- 1 | PREFIX owl: 2 | PREFIX rdfs: 3 | PREFIX xsd: 4 | 5 | DELETE { ?s rdfs:label 'nuclear lumen' ; 6 | rdfs:subClassOf ?super } 7 | INSERT { ?s rdfs:label 'obsolete nuclear lumen' ; 8 | owl:deprecated 'true'^^xsd:boolean } 9 | WHERE { ?s rdfs:label 'nuclear lumen'; 10 | rdfs:subClassOf ?super } -------------------------------------------------------------------------------- /robot-core/src/test/resources/xref-repaired.obo: -------------------------------------------------------------------------------- 1 | ontology: xref-need-of-repair 2 | 3 | [Term] 4 | id: GO:1 5 | name: leaf node 6 | is_a: GO:3 7 | 8 | [Term] 9 | id: GO:2 10 | name: original parent 11 | is_obsolete: true 12 | replaced_by: GO:3 13 | 14 | [Term] 15 | id: GO:3 16 | name: replacement parent 17 | xref: FOO:1 18 | xref: FOO:2 19 | 20 | [Term] 21 | id: GO:4 22 | name: other term 23 | is_obsolete: true 24 | replaced_by: GO:3 25 | -------------------------------------------------------------------------------- /docs/examples/inferred-equiv.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | 4 | ## A and B will be inferred to be equivalent. 5 | ## This is a new inference, not originally asserted. 6 | ## This is a red flag as such equivalencies are often unintentional 7 | Class: A 8 | EquivalentTo: C and D 9 | 10 | Class: B 11 | EquivalentTo: C and D 12 | 13 | Class: C 14 | 15 | Class: D 16 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/xref-need-of-repair.obo: -------------------------------------------------------------------------------- 1 | ontology: xref-need-of-repair 2 | 3 | [Term] 4 | id: GO:1 5 | name: leaf node 6 | is_a: GO:2 7 | 8 | [Term] 9 | id: GO:2 10 | name: original parent 11 | is_obsolete: true 12 | replaced_by: GO:3 13 | xref: FOO:1 14 | 15 | [Term] 16 | id: GO:3 17 | name: replacement parent 18 | 19 | [Term] 20 | id: GO:4 21 | name: other term 22 | is_obsolete: true 23 | replaced_by: GO:3 24 | xref: FOO:2 25 | -------------------------------------------------------------------------------- /docs/examples/subset.obo: -------------------------------------------------------------------------------- 1 | ontology: test 2 | subsetdef: foo "foo" 3 | 4 | [Term] 5 | id: ONT:1 6 | subset: foo 7 | 8 | [Term] 9 | id: ONT:2 10 | relationship: part_of ONT:1 11 | 12 | [Term] 13 | id: ONT:3 14 | relationship: part_of ONT:2 15 | 16 | [Term] 17 | id: ONT:4 18 | relationship: part_of ONT:3 19 | 20 | [Term] 21 | id: ONT:5 22 | is_a: ONT:4 23 | subset: foo 24 | 25 | [Typedef] 26 | id: part_of 27 | is_transitive: true 28 | xref: BFO:0000050 -------------------------------------------------------------------------------- /robot-core/src/test/resources/inferred-equiv.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | 4 | ## A and B will be inferred to be equivalent. 5 | ## This is a new inference, not originally asserted. 6 | ## This is a red flag as such equivalencies are often unintentional 7 | Class: A 8 | EquivalentTo: C and D 9 | 10 | Class: B 11 | EquivalentTo: C and D 12 | 13 | Class: C 14 | 15 | Class: D 16 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/subset.obo: -------------------------------------------------------------------------------- 1 | ontology: test 2 | subsetdef: foo "foo" 3 | 4 | [Term] 5 | id: ONT:1 6 | subset: foo 7 | 8 | [Term] 9 | id: ONT:2 10 | relationship: part_of ONT:1 11 | 12 | [Term] 13 | id: ONT:3 14 | relationship: part_of ONT:2 15 | 16 | [Term] 17 | id: ONT:4 18 | relationship: part_of ONT:3 19 | 20 | [Term] 21 | id: ONT:5 22 | is_a: ONT:4 23 | subset: foo 24 | 25 | [Typedef] 26 | id: part_of 27 | is_transitive: true 28 | xref: BFO:0000050 -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/InconsistentOntologyException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | /** 4 | * Ontology contains logical inconsistencies. 5 | * 6 | *

Note inconsistency is not the same as incoherency 7 | * 8 | * @author cjm 9 | */ 10 | public class InconsistentOntologyException extends OntologyLogicException { 11 | 12 | /** */ 13 | private static final long serialVersionUID = -1915338965653787481L; 14 | } 15 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/legacy-template-logical.csv: -------------------------------------------------------------------------------- 1 | Label,Label Comment,Nested Comment,See Also,Type,Parent,Parts,Parts Annotation 2 | A rdfs:label,>AL rdfs:comment@en,>>A rdfs:comment,>AI rdfs:seeAlso,CLASS_TYPE,C %,C part_of some %,>C rdfs:comment 3 | ,skip this row,,,,,, 4 | test 3,test 3 comment,test 3 comment comment,http://robot.obolibrary.org/,subclass,test2,test one,test one comment 5 | test 4,test 4 comment,,,equivalent,test one,(test2 and 'test 3'),test2 and test 3 comment -------------------------------------------------------------------------------- /docs/examples/uvula_multiple_list.ofn: -------------------------------------------------------------------------------- 1 | Prefix(:=) 2 | Prefix(owl:=) 3 | Prefix(rdf:=) 4 | Prefix(xml:=) 5 | Prefix(xsd:=) 6 | Prefix(rdfs:=) 7 | 8 | 9 | Ontology( 10 | 11 | ) -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/OntologyStructureException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | /** 4 | * Ontology contains contains structure that constitutes an exception 5 | * 6 | *

Example: a logical axiom referencing a deprecated entity 7 | * 8 | * @author cjm 9 | */ 10 | public abstract class OntologyStructureException extends Exception { 11 | 12 | /** */ 13 | private static final long serialVersionUID = 8211835056287159708L; 14 | } 15 | -------------------------------------------------------------------------------- /docs/examples/release-diff.txt: -------------------------------------------------------------------------------- 1 | 1 axioms in left ontology but not in right ontology: 2 | - OntologyID(OntologyIRI() VersionIRI()) 3 | 4 | 3 axioms in right ontology but not in left ontology: 5 | + AnnotationAssertion(rdfs:label "Junk") 6 | + Declaration(Class()) 7 | + OntologyID(OntologyIRI() VersionIRI()) 8 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/import-non-reasoned.owl: -------------------------------------------------------------------------------- 1 | Prefix: : 2 | Ontology: 3 | Import: 4 | 5 | ## Test 6 | 7 | # note that by referencing X, we bring it into the signature, 8 | # this will in turn lead to inferences about X leaking into this ontology 9 | # when we materialize 10 | 11 | Class: X 12 | Class: Z SubClassOf: X 13 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/template-logical.csv: -------------------------------------------------------------------------------- 1 | Label,Label Comment,Nested Comment,See Also,Parent,Parts,Parts Annotation,Equivalent,Equivalent Parts,Eq Annotation 2 | A rdfs:label,>AL rdfs:comment@en,>>A rdfs:comment,>AI rdfs:seeAlso,SC %,SC part_of some %,>A rdfs:comment,EC %,EC part_of some %,>A rdfs:comment 3 | ,skip this row,,,,,,,, 4 | test 3,test 3 comment,test 3 comment comment,http://robot.obolibrary.org/,test2,test one,test one comment,,, 5 | test 4,test 4 comment,,,,,,test one,(test2 and 'test 3'),test2 and test 3 comment 6 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/legacy-template.csv: -------------------------------------------------------------------------------- 1 | Label,Label Comment,Nested Comment,See Also,ID,Synonyms,Type,Parent,Parts,Parts Annotation 2 | A rdfs:label,>AL rdfs:comment@en,>>A rdfs:comment,>AI rdfs:seeAlso,ID,A IAO:0000118 SPLIT=|,CLASS_TYPE,C %,C part_of some %,>C rdfs:comment 3 | skip this row 4 | test 3,test 3 comment,test 3 comment comment,http://robot.obolibrary.org/,GO:1234,synonym 1|synonym 2,subclass,test2,test one,test one comment 5 | test 4,test 4 comment,,,GO:1235,,equivalent,test one,(test2 and 'test 3'),test2 and test 3 comment 6 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple1.diff: -------------------------------------------------------------------------------- 1 | 1 axioms in left ontology but not in right ontology: 2 | - OntologyID(OntologyIRI() VersionIRI()) 3 | 4 | 2 axioms in right ontology but not in left ontology: 5 | + AnnotationAssertion(rdfs:label "TEST #1"^^xsd:string) 6 | + OntologyID(OntologyIRI() VersionIRI()) 7 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/redundant_expr_reduced.obo: -------------------------------------------------------------------------------- 1 | ontology: redundant_expr 2 | 3 | [Term] 4 | id: NCBITaxon:1 5 | name: example taxon 6 | 7 | [Term] 8 | id: X:1 9 | is_a: X:2 10 | 11 | [Term] 12 | id: X:2 13 | relationship: part_of X:3 14 | 15 | [Term] 16 | id: X:3 17 | is_a: X:4 18 | 19 | [Term] 20 | id: X:4 21 | relationship: part_of X:5 22 | 23 | [Term] 24 | id: X:5 25 | relationship: part_of X:6 26 | 27 | [Term] 28 | id: X:6 29 | name: x6 30 | 31 | [Typedef] 32 | id: part_of 33 | xref: BFO:0000050 34 | is_transitive: true 35 | -------------------------------------------------------------------------------- /docs/examples/nucleus-ids.csv: -------------------------------------------------------------------------------- 1 | ID,SubClass Of 2 | GO:0005575, 3 | GO:0005622,GO:0044464 4 | GO:0005623,GO:0005575 5 | GO:0005634,GO:0043231 6 | GO:0031974,GO:0005575 7 | GO:0031981,GO:0044428|GO:0070013 8 | GO:0043226,GO:0005575 9 | GO:0043227,GO:0043226 10 | GO:0043229,GO:0043226|GO:0044424 11 | GO:0043231,GO:0043227|GO:0043229 12 | GO:0043233,GO:0031974|GO:0044422 13 | GO:0044422,GO:0005575 14 | GO:0044424,GO:0044464 15 | GO:0044428,GO:0044446 16 | GO:0044446,GO:0044422|GO:0044424 17 | GO:0044464,GO:0005575 18 | GO:0070013,GO:0043233|GO:0044446 19 | -------------------------------------------------------------------------------- /docs/examples/uberon_template.csv: -------------------------------------------------------------------------------- 1 | ID,Label,Definition,Definition Source,See Also,Editor,RDF Type,Class Type,Parent IRI 2 | ID,A rdfs:label,A IAO:0000115,A IAO:0000119,AI rdfs:seeAlso,A IAO:0000117,TYPE,CLASS_TYPE,CI 3 | UBERON:0000995,brain,The brain is the center of the nervous system in all vertebrate...,UBERON,http://en.wikipedia.org/wiki/Brain,Becky Tauber,owl:Class,subclass,UBERON:0000062 4 | UBERON:0000211,ligament,Dense regular connective tissue...,UBERON,http://purl.obolibrary.org/obo/go/references/0000034,Becky Tauber,owl:Class,subclass,UBERON:0000062 5 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/1016-report-json-failure/input.owl: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | skos:Concept interferes with "quoted text" 10 | 11 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/template.csv: -------------------------------------------------------------------------------- 1 | Label,Label Comment,Nested Comment,See Also,ID,Synonyms,Parent,Parts,Parts Annotation,Equivalent,Eq Annotation 2 | A rdfs:label,>AL rdfs:comment@en,>>A rdfs:comment,>AI rdfs:seeAlso,ID,A IAO:0000118 SPLIT=|,SC %,SC part_of some %,>A rdfs:comment,EC %,>A rdfs:comment 3 | skip this row 4 | test 3,test 3 comment,test 3 comment comment,http://robot.obolibrary.org/,GO:1234,synonym 1|synonym 2,test2,test one,test one comment,, 5 | test 4,test 4 comment,,,GO:1235,,,,,'test one' and (part_of some (test2 and 'test 3')),test2 and test 3 comment -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM maven:3-openjdk-11-slim 2 | 3 | RUN useradd -m robot 4 | RUN mkdir -p /usr/src/app 5 | RUN chown robot /usr/src/app 6 | 7 | COPY pom.xml /usr/src/app 8 | COPY robot-command /usr/src/app/robot-command 9 | COPY robot-core /usr/src/app/robot-core 10 | COPY robot-maven-plugin /usr/src/app/robot-maven-plugin 11 | COPY bin/robot /usr/local/bin/ 12 | RUN chown -R robot:robot /usr/src/app 13 | 14 | USER robot 15 | WORKDIR /usr/src/app 16 | RUN mvn install -DskipTests 17 | 18 | USER root 19 | RUN cp bin/robot.jar /usr/local/bin 20 | USER robot 21 | ENTRYPOINT ["robot"] 22 | -------------------------------------------------------------------------------- /docs/examples/part_of.sparql: -------------------------------------------------------------------------------- 1 | PREFIX rdf: 2 | PREFIX owl: 3 | PREFIX rdfs: 4 | PREFIX GO: 5 | PREFIX BFO: 6 | 7 | CONSTRUCT { 8 | GO:0031981 BFO:0000050 ?whole . # 'nuclear lumen' 'part of' 9 | } 10 | WHERE { 11 | GO:0031981 rdfs:subClassOf [ # nuclear lumen 12 | rdf:type owl:Restriction ; 13 | owl:onProperty BFO:0000050 ; # part of 14 | owl:someValuesFrom ?whole 15 | ] . 16 | } 17 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %-5p %m%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /robot-command/src/main/resources/logback.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | %d %-5p %c - %m%n 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /docs/report_queries/illegal_use_of_built_in_vocabulary.md: -------------------------------------------------------------------------------- 1 | # Illegal Use of Built-In Vocabulary 2 | 3 | **Problem:** Redefining built-in vocabulary should never be done. 4 | 5 | **Solution:** Remove any statements about build-in vocabulary 6 | 7 | ``` 8 | PREFIX owl: 9 | PREFIX rdf: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?entity { 13 | rdf:type 14 | } 15 | ?entity ?property ?value1 16 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 17 | } 18 | ORDER BY ?entity 19 | ``` 20 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/illegal_use_of_built_in_vocabulary.rq: -------------------------------------------------------------------------------- 1 | # # Illegal Use of Built-In Vocabulary 2 | # 3 | # **Problem:** Redefining built-in vocabulary should never be done. 4 | # 5 | # **Solution:** Remove any statements about build-in vocabulary 6 | 7 | PREFIX owl: 8 | PREFIX rdf: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?entity { 12 | rdf:type 13 | } 14 | ?entity ?property ?value1 15 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 16 | } 17 | ORDER BY ?entity 18 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/import_test.owl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/blazegraph.properties: -------------------------------------------------------------------------------- 1 | # changing the axiom model to none essentially disables all inference 2 | com.bigdata.rdf.store.AbstractTripleStore.axiomsClass=com.bigdata.rdf.axioms.NoAxioms 3 | com.bigdata.rdf.store.AbstractTripleStore.quads=true 4 | com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers=false 5 | 6 | # turn off automatic inference in the SAIL 7 | com.bigdata.rdf.sail.truthMaintenance=false 8 | 9 | # turn off the free text index 10 | com.bigdata.rdf.store.AbstractTripleStore.textIndex=false 11 | 12 | com.bigdata.rdf.sail.bufferCapacity=100000 13 | com.bigdata.journal.AbstractJournal.bufferMode=DiskRW -------------------------------------------------------------------------------- /docs/report_queries/invalid_xref.md: -------------------------------------------------------------------------------- 1 | # Invalid Xref 2 | 3 | **Problem:** A database_cross_reference is not in CURIE format. 4 | 5 | **Solution:** Replace the reference with a [CURIE](https://www.w3.org/TR/2010/NOTE-curie-20101216/). 6 | 7 | ```sparql 8 | PREFIX oboInOwl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property {oboInOwl:hasDbXref} 13 | ?entity ?property ?value . 14 | FILTER (!regex(?value, "^[a-z|A-Z|_|\\-|0-9]*:(?!$)\\S*$")) 15 | FILTER (!isBlank(?entity)) 16 | } 17 | ORDER BY ?entity 18 | ``` 19 | -------------------------------------------------------------------------------- /docs/examples/my-catalog.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | "@context": 3 | resources: https://github.com/ontodev/robot/robot-core/src/test/resources/ 4 | simple: resources:simple.owl# 5 | label: rdfs:label 6 | parent: 7 | "@id": rdfs:subClassOf 8 | "@type": "@id" 9 | id: "@id" 10 | type: "@type" 11 | value: "@value" 12 | 13 | "@graph": 14 | - id: resources:simple.owl 15 | type: owl:Ontology 16 | - id: simple:test1 17 | type: owl:Class 18 | label: 19 | - value: test one 20 | - value: Test 1 21 | - id: simple:test2 22 | type: owl:Class 23 | parent: simple:test1 24 | -------------------------------------------------------------------------------- /docs/report_queries/misused_replaced_by.md: -------------------------------------------------------------------------------- 1 | # Misused Replaced-by Annotation 2 | 3 | **Problem:** A replaced-by annotation was used on a non-obsolete class. 4 | 5 | **Solution:** Remove the replaced-by annotation or obsolete the class. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX oboInOwl: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { } 13 | ?entity ?property ?value . 14 | FILTER NOT EXISTS { ?entity owl:deprecated true } 15 | FILTER (!isBlank(?entity)) 16 | } 17 | ORDER BY ?entity 18 | ``` 19 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/invalid_xref.rq: -------------------------------------------------------------------------------- 1 | # # Invalid Xref 2 | # 3 | # **Problem:** A database_cross_reference is not in CURIE format. 4 | # 5 | # **Solution:** Replace the reference with a [CURIE](https://www.w3.org/TR/2010/NOTE-curie-20101216/). 6 | 7 | PREFIX oboInOwl: 8 | PREFIX rdfs: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property {oboInOwl:hasDbXref} 12 | ?entity ?property ?value . 13 | FILTER (!regex(?value, "^[a-z|A-Z|_|\\-|0-9]*:(?!$)\\S*$")) 14 | FILTER (!isBlank(?entity)) 15 | } 16 | ORDER BY ?entity 17 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/misused_replaced_by.rq: -------------------------------------------------------------------------------- 1 | # # Misused Replaced-by Annotation 2 | # 3 | # **Problem:** A replaced-by annotation was used on a non-obsolete class. 4 | # 5 | # **Solution:** Remove the replaced-by annotation or obsolete the class. 6 | 7 | PREFIX owl: 8 | PREFIX oboInOwl: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { } 12 | ?entity ?property ?value . 13 | FILTER NOT EXISTS { ?entity owl:deprecated true } 14 | FILTER (!isBlank(?entity)) 15 | } 16 | ORDER BY ?entity 17 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/1016-report-json-failure/output.yaml: -------------------------------------------------------------------------------- 1 | - level: 'ERROR' 2 | violations: 3 | - missing_label: 4 | - subject: "http://test.org/test#A" 5 | - missing_ontology_description: 6 | - subject: "http://test.org/test" 7 | - missing_ontology_license: 8 | - subject: "http://test.org/test" 9 | - missing_ontology_title: 10 | - subject: "http://test.org/test" 11 | - level: 'WARN' 12 | violations: 13 | - level: 'INFO' 14 | violations: 15 | - lowercase_definition: 16 | - subject: "http://test.org/test#A" 17 | property: "IAO:0000115" 18 | values: 19 | - "skos:Concept interferes with \"quoted text\"" 20 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/redundant_expr.obo: -------------------------------------------------------------------------------- 1 | ontology: redundant_expr 2 | 3 | [Term] 4 | id: NCBITaxon:1 5 | name: example taxon 6 | 7 | [Term] 8 | id: X:1 9 | is_a: X:2 10 | relationship: part_of X:6 !!! redundant 11 | relationship: part_of X:5 {gci_relation="part_of", gci_filler="NCBITaxon:1"} !!! redundant 12 | 13 | [Term] 14 | id: X:2 15 | relationship: part_of X:3 16 | 17 | [Term] 18 | id: X:3 19 | is_a: X:4 20 | 21 | [Term] 22 | id: X:4 23 | relationship: part_of X:5 24 | 25 | [Term] 26 | id: X:5 27 | relationship: part_of X:6 28 | 29 | [Term] 30 | id: X:6 31 | name: x6 32 | 33 | [Typedef] 34 | id: part_of 35 | xref: BFO:0000050 36 | is_transitive: true 37 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/docs-template.csv: -------------------------------------------------------------------------------- 1 | ID,Label,Definition,Definition Source,See Also,Editor,RDF Type,Class Type,Parent IRI 2 | ID,A rdfs:label,A IAO:0000115,A IAO:0000119,AI rdfs:seeAlso,A IAO:0000117,TYPE,CLASS_TYPE,CI 3 | ex:F344N,F 344/N,An inbred strain of rat used in many scientific investigations.,James A. Overton,http://www.informatics.jax.org/external/festing/rat/docs/F344.shtml,James A. Overton,owl:Class,subclass,NCBITaxon:10116 4 | ex:B6C3F1,B6C3F1,An inbred strain of mouse used in many scientific investigations.,James A. Overton,http://jaxmice.jax.org/strain/100010.html,James A. Overton,owl:Class,subclass,NCBITaxon:10090 5 | ex:rat-1234,rat 1234,,,F 344/N,,ex:F344N,, -------------------------------------------------------------------------------- /docs/report_queries/deprecated_boolean_datatype.md: -------------------------------------------------------------------------------- 1 | # Deprecated Boolean Datatype 2 | 3 | **Problem:** When an entity is deprecated using the owl:deprecated annotation property, the value of the annotation must be a boolean data type. 4 | 5 | **Solution:** Replace deprecated value with a boolean data type. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX xsd: 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { 12 | owl:deprecated 13 | } 14 | ?entity ?property ?value . 15 | FILTER (datatype(?value) != xsd:boolean) 16 | FILTER (!isBlank(?entity)) 17 | } 18 | ORDER BY ?entity 19 | ``` 20 | -------------------------------------------------------------------------------- /docs/report_queries/equivalent_pair.md: -------------------------------------------------------------------------------- 1 | # Equivalent Pair 2 | 3 | **Problem:** An entity has a one-to-one equivalency with another entity. This may be intentional (assuming it is not annotated with `is_inferred true`), or it may be due to incorrect logic and the reasoner asserting the equivalency. 4 | 5 | **Solution:** Ensure the reasoner is not incorrectly inferring equivalency. If so, update the logical axioms. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property {owl:equivalentClass} 12 | ?entity ?property ?value . 13 | FILTER (!isBlank(?value)) 14 | } 15 | ORDER BY ?entity 16 | ``` 17 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/deprecated_boolean_datatype.rq: -------------------------------------------------------------------------------- 1 | # # Deprecated Boolean Datatype 2 | # 3 | # **Problem:** When an entity is deprecated using the owl:deprecated annotation property, the value of the annotation must be a boolean data type. 4 | # 5 | # **Solution:** Replace deprecated value with a boolean data type. 6 | 7 | PREFIX owl: 8 | PREFIX xsd: 9 | SELECT DISTINCT ?entity ?property ?value WHERE { 10 | VALUES ?property { 11 | owl:deprecated 12 | } 13 | ?entity ?property ?value . 14 | FILTER (datatype(?value) != xsd:boolean) 15 | FILTER (!isBlank(?entity)) 16 | } 17 | ORDER BY ?entity 18 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/equivalent_pair.rq: -------------------------------------------------------------------------------- 1 | # # Equivalent Pair 2 | # 3 | # **Problem:** An entity has a one-to-one equivalency with another entity. This may be intentional (assuming it is not annotated with `is_inferred true`), or it may be due to incorrect logic and the reasoner asserting the equivalency. 4 | # 5 | # **Solution:** Ensure the reasoner is not incorrectly inferring equivalency. If so, update the logical axioms. 6 | 7 | PREFIX owl: 8 | 9 | SELECT DISTINCT ?entity ?property ?value WHERE { 10 | VALUES ?property {owl:equivalentClass} 11 | ?entity ?property ?value . 12 | FILTER (!isBlank(?value)) 13 | } 14 | ORDER BY ?entity 15 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/IncoherentRBoxException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | import java.util.Set; 4 | import org.semanticweb.owlapi.model.OWLObjectProperty; 5 | 6 | /** 7 | * Ontology contains unsatisfiable properties. 8 | * 9 | * @author cjm 10 | */ 11 | public class IncoherentRBoxException extends OntologyLogicException { 12 | 13 | /** */ 14 | private static final long serialVersionUID = 2608045757804483323L; 15 | 16 | /** @param unsatisfiableProperties The unsatisfiable properties. */ 17 | public IncoherentRBoxException(Set unsatisfiableProperties) { 18 | super(unsatisfiableProperties); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docs/report_queries/missing_obsolete_label.md: -------------------------------------------------------------------------------- 1 | # Missing Obsolete Label 2 | 3 | **Problem:** An obsolete entity does not have a label beginning with "obsolete". Adding this prefix ensures that users are aware the entity has been deprecated. 4 | 5 | **Solution:** Add the "obsolete" (or "OBSOLETE") prefix. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { rdfs:label } 13 | ?entity owl:deprecated true . 14 | ?entity ?property ?value . 15 | FILTER (!regex(?value, "^obsolete", "i")) 16 | FILTER (!isBlank(?entity)) 17 | } 18 | ORDER BY ?entity 19 | ``` 20 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/IncoherentTBoxException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | import java.util.Set; 4 | import org.semanticweb.owlapi.model.OWLClass; 5 | 6 | /** 7 | * Ontology contains unsatisfiable classes. 8 | * 9 | * @author cjm 10 | */ 11 | public class IncoherentTBoxException extends OntologyLogicException { 12 | 13 | /** */ 14 | private static final long serialVersionUID = -6157565029337883652L; 15 | 16 | /** @param unsatisfiableClasses list of unsat classes */ 17 | public IncoherentTBoxException(Set unsatisfiableClasses) { 18 | // TODO Auto-generated constructor stub 19 | super(unsatisfiableClasses); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/InvalidReferenceException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | import java.util.Set; 4 | import org.obolibrary.robot.checks.InvalidReferenceViolation; 5 | 6 | /** 7 | * Ontology contains unsatisfiable classes. 8 | * 9 | * @author cjm 10 | */ 11 | public class InvalidReferenceException extends OntologyStructureException { 12 | 13 | /** */ 14 | private static final long serialVersionUID = -6157565029337883652L; 15 | 16 | /** @param violations set of invalid reference violations */ 17 | public InvalidReferenceException(Set violations) { 18 | // TODO Auto-generated constructor stub 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/ColumnException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | /** Template column cannot be parsed. */ 4 | public class ColumnException extends Exception { 5 | private static final long serialVersionUID = -2799779465303691943L; 6 | 7 | /** 8 | * Throw new ColumnException with message. 9 | * 10 | * @param s message 11 | */ 12 | public ColumnException(String s) { 13 | super(s); 14 | } 15 | 16 | /** 17 | * Throw new ColumnException with message and exception cause. 18 | * 19 | * @param s message 20 | * @param e cause 21 | */ 22 | public ColumnException(String s, Exception e) { 23 | super(s, e); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/reason/EquivalentAxiomReasoningTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.reason; 2 | 3 | import org.semanticweb.owlapi.model.OWLAxiom; 4 | 5 | /** 6 | * Created by edouglass on 5/9/17. 7 | * 8 | *

Performs a test on an OWLAxiom and states if it "fails". This will be up to the implementation 9 | */ 10 | public interface EquivalentAxiomReasoningTest { 11 | 12 | /** 13 | * Returns true if the given axiom fails the type of Test this Reasoning Test is. For example, if 14 | * no equivalent axioms are allowed, any axiom here should return false. 15 | * 16 | * @param axiom OWLAxiom 17 | * @return boolean 18 | */ 19 | boolean fails(OWLAxiom axiom); 20 | } 21 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_obsolete_label.rq: -------------------------------------------------------------------------------- 1 | # # Missing Obsolete Label 2 | # 3 | # **Problem:** An obsolete entity does not have a label beginning with "obsolete". Adding this prefix ensures that users are aware the entity has been deprecated. 4 | # 5 | # **Solution:** Add the "obsolete" (or "OBSOLETE") prefix. 6 | 7 | PREFIX owl: 8 | PREFIX rdfs: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { rdfs:label } 12 | ?entity owl:deprecated true . 13 | ?entity ?property ?value . 14 | FILTER (!regex(?value, "^obsolete", "i")) 15 | FILTER (!isBlank(?entity)) 16 | } 17 | ORDER BY ?entity -------------------------------------------------------------------------------- /docs/report_queries/missing_subset_declaration.md: -------------------------------------------------------------------------------- 1 | # Missing Subset Declaration 2 | 3 | **Problem:** A subset is used in an annotation, but is not properly declared as a child of oboInOwl:SubsetProperty. This can cause problems with conversions to OBO format. 4 | 5 | **Solution:** Make the subset a child of oboInOwl:SubsetProperty. 6 | 7 | ```sparql 8 | PREFIX rdfs: 9 | PREFIX oboInOwl: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { rdfs:subPropertyOf } 13 | ?x oboInOwl:inSubset ?entity . 14 | FILTER NOT EXISTS { ?entity ?property oboInOwl:SubsetProperty } 15 | } 16 | ORDER BY ?entity 17 | ``` -------------------------------------------------------------------------------- /docs/report_queries/missing_ontology_license.md: -------------------------------------------------------------------------------- 1 | # Missing Ontology License 2 | 3 | **Problem:** The ontology header is missing required metadata: [license](http://dublincore.org/documents/dcmi-terms/#terms-license). 4 | 5 | **OBO Foundry Principle:** [1 - Open](http://obofoundry.org/principles/fp-001-open.html) 6 | 7 | **Solution:** Add the missing license. See link for appropriate property. 8 | 9 | ```sparql 10 | PREFIX dcterms: 11 | PREFIX owl: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property { dcterms:license } 15 | ?entity a owl:Ontology . 16 | OPTIONAL { ?entity ?property ?value } 17 | FILTER (!bound(?value)) 18 | } 19 | ``` 20 | -------------------------------------------------------------------------------- /docs/report_queries/missing_ontology_title.md: -------------------------------------------------------------------------------- 1 | # Missing Ontology Title 2 | 3 | **Problem:** The ontology header is missing required metadata: [title](http://dublincore.org/documents/dcmi-terms/#elements-title). 4 | 5 | **Solution:** Add the missing title. See link for appropriate property. 6 | 7 | ```sparql 8 | PREFIX dc: 9 | PREFIX dcterms: 10 | PREFIX owl: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | ?entity a owl:Ontology . 14 | FILTER NOT EXISTS { 15 | {?entity dc:title ?value . } 16 | UNION 17 | {?entity dcterms:title ?value . } 18 | } 19 | BIND(dcterms:title as ?property) 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/examples/revert.ru: -------------------------------------------------------------------------------- 1 | PREFIX owl: 2 | PREFIX rdfs: 3 | PREFIX xsd: 4 | 5 | DELETE { ?s rdfs:label 'obsolete nuclear lumen' ; 6 | owl:deprecated 'true'^^xsd:boolean } 7 | INSERT { ?s rdfs:label 'nuclear lumen' ; 8 | rdfs:subClassOf ; 9 | rdfs:subClassOf ; 10 | rdfs:subClassOf [ a owl:Restriction ; 11 | owl:onProperty ; 12 | owl:someValuesFrom ]} 13 | WHERE { ?s rdfs:label 'obsolete nuclear lumen' } -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_ontology_title.rq: -------------------------------------------------------------------------------- 1 | # # Missing Ontology Title 2 | # 3 | # **Problem:** The ontology header is missing required metadata: [title](http://dublincore.org/documents/dcmi-terms/#elements-title). 4 | # 5 | # **Solution:** Add the missing title. See link for appropriate property. 6 | 7 | PREFIX dc: 8 | PREFIX dcterms: 9 | PREFIX owl: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | ?entity a owl:Ontology . 13 | FILTER NOT EXISTS { 14 | {?entity dc:title ?value . } 15 | UNION 16 | {?entity dcterms:title ?value . } 17 | } 18 | BIND(dcterms:title as ?property) 19 | } 20 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_ontology_license.rq: -------------------------------------------------------------------------------- 1 | # # Missing Ontology License 2 | # 3 | # **Problem:** The ontology header is missing required metadata: [license](http://dublincore.org/documents/dcmi-terms/#terms-license). 4 | # 5 | # **OBO Foundry Principle:** [1 - Open](http://obofoundry.org/principles/fp-001-open.html) 6 | # 7 | # **Solution:** Add the missing license. See link for appropriate property. 8 | 9 | PREFIX dcterms: 10 | PREFIX owl: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { dcterms:license } 14 | ?entity a owl:Ontology . 15 | OPTIONAL { ?entity ?property ?value } 16 | FILTER (!bound(?value)) 17 | } 18 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_subset_declaration.rq: -------------------------------------------------------------------------------- 1 | # # Missing Subset Declaration 2 | # 3 | # **Problem:** A synonym type is used in an annotation, but is not properly declared as a child of oboInOwl:SynonymTypeProperty. This can cause problems with conversions to OBO format. 4 | # 5 | # **Solution:** Make the synonym type a child of oboInOwl:SubsetProperty. 6 | 7 | PREFIX rdfs: 8 | PREFIX oboInOwl: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { rdfs:subPropertyOf } 12 | ?x oboInOwl:inSubset ?entity . 13 | FILTER NOT EXISTS { ?entity ?property oboInOwl:SubsetProperty } 14 | } 15 | ORDER BY ?entity -------------------------------------------------------------------------------- /docs/report_queries/multiple_equivalent_class_definitions.md: -------------------------------------------------------------------------------- 1 | # Multiple Logical Definitions 2 | 3 | **Problem:** A class has more than one equivalent class definition. This should be avoided, as logical definitions can interact adversely. 4 | 5 | **Solution:** Combine the equivalent class statements. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { owl:equivalentClass } 12 | ?entity ?property [ owl:intersectionOf ?value1 ] . 13 | ?entity ?property [ owl:intersectionOf ?value2 ] . 14 | FILTER (?value1 != ?value2) 15 | FILTER (!isBlank(?entity)) 16 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 17 | } 18 | ORDER BY ?entity 19 | ``` 20 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/multiple_equivalent_class_definitions.rq: -------------------------------------------------------------------------------- 1 | # # Multiple Logical Definitions 2 | # 3 | # **Problem:** A class has more than one equivalent class definition. This should be avoided, as logical definitions can interact adversely. 4 | # 5 | # **Solution:** Combine the equivalent class statements. 6 | 7 | PREFIX owl: 8 | 9 | SELECT DISTINCT ?entity ?property ?value WHERE { 10 | VALUES ?property { owl:equivalentClass } 11 | ?entity ?property [ owl:intersectionOf ?value1 ] . 12 | ?entity ?property [ owl:intersectionOf ?value2 ] . 13 | FILTER (?value1 != ?value2) 14 | FILTER (!isBlank(?entity)) 15 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 16 | } 17 | ORDER BY ?entity 18 | -------------------------------------------------------------------------------- /docs/report_queries/missing_synonymtype_declaration.md: -------------------------------------------------------------------------------- 1 | # Missing Synonym Type Declaration 2 | 3 | **Problem:** A synonym type is used in an annotation, but is not properly declared as a child of oboInOwl:SynonymTypeProperty. This can cause problems with conversions to OBO format. 4 | 5 | **Solution:** Make the synonym type a child of oboInOwl:SynonymTypeProperty. 6 | 7 | ```sparql 8 | PREFIX rdfs: 9 | PREFIX oboInOwl: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { rdfs:subPropertyOf } 13 | ?x oboInOwl:hasSynonymType ?entity . 14 | FILTER NOT EXISTS { ?entity ?property oboInOwl:SynonymTypeProperty } 15 | } 16 | ORDER BY ?entity 17 | ``` -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_synonymtype_declaration.rq: -------------------------------------------------------------------------------- 1 | # # Missing Synonym Type Declaration 2 | # 3 | # **Problem:** A synonym type is used in an annotation, but is not properly declared as a child of oboInOwl:SynonymTypeProperty. This can cause problems with conversions to OBO format. 4 | # 5 | # **Solution:** Make the synonym type a child of oboInOwl:SynonymTypeProperty. 6 | 7 | PREFIX rdfs: 8 | PREFIX oboInOwl: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { rdfs:subPropertyOf } 12 | ?x oboInOwl:hasSynonymType ?entity . 13 | FILTER NOT EXISTS { ?entity ?property oboInOwl:SynonymTypeProperty } 14 | } 15 | ORDER BY ?entity -------------------------------------------------------------------------------- /docs/report_queries/missing_ontology_description.md: -------------------------------------------------------------------------------- 1 | # Missing Ontology Description 2 | 3 | **Problem:** The ontology header is missing required metadata: [description](http://dublincore.org/documents/dcmi-terms/#elements-description). 4 | 5 | **Solution:** Add the missing description. See link for appropriate property. 6 | 7 | ```sparql 8 | PREFIX dc: 9 | PREFIX dcterms: 10 | PREFIX owl: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | ?entity a owl:Ontology . 14 | FILTER NOT EXISTS { 15 | {?entity dc:description ?value . } 16 | UNION 17 | {?entity dcterms:description ?value . } 18 | } 19 | BIND(dcterms:description as ?property) 20 | } 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/report_queries/lowercase_definition.md: -------------------------------------------------------------------------------- 1 | # Lowercase Definition 2 | 3 | **Problem:** A definition or elucidation does not begin with an uppercase letter. This may be indicative of inconsistent formatting. 4 | 5 | **OBO Foundry Principle:** [6 - Textual Definitions](http://www.obofoundry.org/principles/fp-006-textual-definitions.html) 6 | 7 | **Solution:** Capitalize the first letter of the definition, or disregard this INFO. 8 | 9 | ```sparql 10 | PREFIX obo: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { obo:IAO_0000115 14 | obo:IAO_0000600 } 15 | ?entity ?property ?value . 16 | FILTER (!regex(?value, "^[A-Z0-9]")) 17 | FILTER (!isBlank(?entity)) 18 | } 19 | ORDER BY ?entity 20 | ``` 21 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_ontology_description.rq: -------------------------------------------------------------------------------- 1 | # # Missing Ontology Description 2 | # 3 | # **Problem:** The ontology header is missing required metadata: [description](http://dublincore.org/documents/dcmi-terms/#elements-description). 4 | # 5 | # **Solution:** Add the missing description. See link for appropriate property. 6 | 7 | PREFIX dc: 8 | PREFIX dcterms: 9 | PREFIX owl: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | ?entity a owl:Ontology . 13 | FILTER NOT EXISTS { 14 | {?entity dc:description ?value . } 15 | UNION 16 | {?entity dcterms:description ?value . } 17 | } 18 | BIND(dcterms:description as ?property) 19 | } 20 | -------------------------------------------------------------------------------- /docs/report_queries/annotation_whitespace.md: -------------------------------------------------------------------------------- 1 | # Annotation Whitespace 2 | 3 | **Problem:** An annotation has leading or trailing whitespace, usually a single space. 4 | 5 | **Solution:** Re-format the annotation to remove additional whitespace. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | {?property a owl:AnnotationProperty . 13 | ?entity ?property ?value . 14 | FILTER REGEX(str(?value), "[\\s\r\n]+$") 15 | FILTER (!isBlank(?entity))} 16 | UNION 17 | {?property a owl:AnnotationProperty . 18 | ?entity ?property ?value . 19 | FILTER REGEX(str(?value), "^[\\s\r\n]+") 20 | FILTER (!isBlank(?entity))} 21 | } 22 | ORDER BY ?entity 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/report_queries/label_formatting.md: -------------------------------------------------------------------------------- 1 | # Label Formatting 2 | 3 | **Problem:** Formatting characters are used in a label. This may cause issues when trying to reference the entity by label. 4 | 5 | **Solution:** Remove formatting characters from label. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | { 13 | VALUES ?property {rdfs:label} 14 | ?entity ?property ?value . 15 | FILTER regex(?value, "\n") 16 | FILTER (!isBlank(?entity)) 17 | } 18 | UNION 19 | { 20 | VALUES ?property {rdfs:label} 21 | ?entity ?property ?value . 22 | FILTER regex(?value, "\t") 23 | FILTER (!isBlank(?entity)) 24 | } 25 | } 26 | ORDER BY ?entity 27 | ``` 28 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/lowercase_definition.rq: -------------------------------------------------------------------------------- 1 | # # Lowercase Definition 2 | # 3 | # **Problem:** A definition or elucidation does not begin with an uppercase letter. This may be indicative of inconsistent formatting. 4 | # 5 | # **OBO Foundry Principle:** [6 - Textual Definitions](http://www.obofoundry.org/principles/fp-006-textual-definitions.html) 6 | # 7 | # **Solution:** Capitalize the first letter of the definition, or disregard this INFO. 8 | 9 | PREFIX obo: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { obo:IAO_0000115 13 | obo:IAO_0000600 } 14 | ?entity ?property ?value . 15 | FILTER (!regex(?value, "^[A-Z0-9]")) 16 | FILTER (!isBlank(?entity)) 17 | } 18 | ORDER BY ?entity 19 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reason_exclude_tautologies.ofn: -------------------------------------------------------------------------------- 1 | Prefix(:=) 2 | Prefix(owl:=) 3 | Prefix(rdf:=) 4 | Prefix(xml:=) 5 | Prefix(xsd:=) 6 | Prefix(rdfs:=) 7 | 8 | 9 | Ontology( 10 | 11 | Declaration(Class(:A)) 12 | Declaration(Class(:B)) 13 | Declaration(Class(:C)) 14 | Declaration(ObjectProperty(:r)) 15 | 16 | ############################ 17 | # Classes 18 | ############################ 19 | 20 | # Class: :A (:A) 21 | 22 | SubClassOf(:A ObjectSomeValuesFrom(:r :B)) 23 | 24 | # Class: :C (:C) 25 | 26 | EquivalentClasses(:C ObjectSomeValuesFrom(:r :B)) 27 | 28 | 29 | ) -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/annotation_whitespace.rq: -------------------------------------------------------------------------------- 1 | # # Annotation Whitespace 2 | # 3 | # **Problem:** An annotation has leading or trailing whitespace, usually a single space. 4 | # 5 | # **Solution:** Re-format the annotation to remove additional whitespace. 6 | 7 | PREFIX owl: 8 | PREFIX rdfs: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | {?property a owl:AnnotationProperty . 12 | ?entity ?property ?value . 13 | FILTER REGEX(str(?value), "[\\s\r\n]+$") 14 | FILTER (!isBlank(?entity))} 15 | UNION 16 | {?property a owl:AnnotationProperty . 17 | ?entity ?property ?value . 18 | FILTER REGEX(str(?value), "^[\\s\r\n]+") 19 | FILTER (!isBlank(?entity))} 20 | } 21 | ORDER BY ?entity 22 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/label_formatting.rq: -------------------------------------------------------------------------------- 1 | # # Label Formatting 2 | # 3 | # **Problem:** Formatting characters are used in a label. This may cause issues when trying to reference the entity by label. 4 | # 5 | # **Solution:** Remove formatting characters from label. 6 | 7 | PREFIX owl: 8 | PREFIX rdfs: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | { 12 | VALUES ?property {rdfs:label} 13 | ?entity ?property ?value . 14 | FILTER regex(?value, "\n") 15 | FILTER (!isBlank(?entity)) 16 | } 17 | UNION 18 | { 19 | VALUES ?property {rdfs:label} 20 | ?entity ?property ?value . 21 | FILTER regex(?value, "\t") 22 | FILTER (!isBlank(?entity)) 23 | } 24 | } 25 | ORDER BY ?entity 26 | -------------------------------------------------------------------------------- /docs/report_queries/label_whitespace.md: -------------------------------------------------------------------------------- 1 | # Label Whitespace 2 | 3 | **Problem:** A label has leading or trailing whitespace. This may cause issues when trying to reference the entity by label. 4 | 5 | **Solution:** Remove the additional whitespace. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | { 13 | VALUES ?property {rdfs:label} 14 | ?entity ?property ?value . 15 | FILTER REGEX(str(?value), "[\\s\r\n]+$") 16 | FILTER (!isBlank(?entity)) 17 | } 18 | UNION 19 | { 20 | VALUES ?property {rdfs:label} 21 | ?entity ?property ?value . 22 | FILTER REGEX(str(?value), "^[\\s\r\n]+") 23 | FILTER (!isBlank(?entity)) 24 | } 25 | } 26 | ORDER BY ?entity 27 | ``` 28 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/label_whitespace.rq: -------------------------------------------------------------------------------- 1 | # # Label Whitespace 2 | # 3 | # **Problem:** A label has leading or trailing whitespace. This may cause issues when trying to reference the entity by label. 4 | # 5 | # **Solution:** Remove the additional whitespace. 6 | 7 | PREFIX owl: 8 | PREFIX rdfs: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | { 12 | VALUES ?property {rdfs:label} 13 | ?entity ?property ?value . 14 | FILTER REGEX(str(?value), "[\\s\r\n]+$") 15 | FILTER (!isBlank(?entity)) 16 | } 17 | UNION 18 | { 19 | VALUES ?property {rdfs:label} 20 | ?entity ?property ?value . 21 | FILTER REGEX(str(?value), "^[\\s\r\n]+") 22 | FILTER (!isBlank(?entity)) 23 | } 24 | } 25 | ORDER BY ?entity 26 | -------------------------------------------------------------------------------- /docs/report_queries/multiple_labels.md: -------------------------------------------------------------------------------- 1 | # Multiple Labels 2 | 3 | **Problem:** An entity has more than one label. This may cause confusion or misuse, and will prevent translation to OBO format. Excludes deprecated entities. 4 | 5 | **OBO Foundry Principle:** [12 - Naming Conventions](http://www.obofoundry.org/principles/fp-012-naming-conventions.html) 6 | 7 | **Solution:** Remove extra labels. 8 | 9 | ```sparql 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property { rdfs:label } 15 | ?entity ?property ?value . 16 | ?entity ?property ?value2 . 17 | FILTER (?value != ?value2) . 18 | FILTER NOT EXISTS { ?entity owl:deprecated true } 19 | FILTER (!isBlank(?entity)) 20 | } 21 | ORDER BY ?entity 22 | ``` 23 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/multiple_labels.rq: -------------------------------------------------------------------------------- 1 | # # Multiple Labels 2 | # 3 | # **Problem:** An entity has more than one label. This may cause confusion or misuse, and will prevent translation to OBO format. Excludes deprecated entities. 4 | # 5 | # **OBO Foundry Principle:** [12 - Naming Conventions](http://www.obofoundry.org/principles/fp-012-naming-conventions.html) 6 | # 7 | # **Solution:** Remove extra labels. 8 | 9 | PREFIX owl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { rdfs:label } 14 | ?entity ?property ?value . 15 | ?entity ?property ?value2 . 16 | FILTER (?value != ?value2) . 17 | FILTER NOT EXISTS { ?entity owl:deprecated true } 18 | FILTER (!isBlank(?entity)) 19 | } 20 | ORDER BY ?entity 21 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/empty.owl: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /util/check_docs.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import os 4 | import subprocess 5 | import sys 6 | 7 | from collections import defaultdict 8 | 9 | res = subprocess.check_output(['grep " --output" docs/*.md'], shell=True) 10 | test_files = defaultdict(set) 11 | for line in res.decode("utf-8").split("\n"): 12 | if not line.split(): 13 | continue 14 | fname = line.split()[0][5:-1] 15 | output = line.split()[2][8:] 16 | if output: 17 | if output not in test_files: 18 | test_files[output] = set() 19 | test_files[output].add(fname) 20 | 21 | duplicates = {k: v for k, v in test_files.items() if len(v) > 1} 22 | if duplicates: 23 | print(f"ERROR: {len(duplicates)} test output(s) are used in more than one doc") 24 | for output, fnames in duplicates.items(): 25 | print(f"- {output}: " + ", ".join(fnames)) 26 | sys.exit(1) 27 | else: 28 | print("Docs OK!") 29 | -------------------------------------------------------------------------------- /docs/examples/template.csv: -------------------------------------------------------------------------------- 1 | ID,Label,Definition,Definition Source,See Also,Editor,Type,Parent Class,Disjoint Class,Domain,Range,Individual Weight 2 | ID,A rdfs:label,A IAO:0000115,>A IAO:0000119,AI rdfs:seeAlso,A IAO:0000117,TYPE,SC %,DC %,DOMAIN,RANGE,I weight in kilograms 3 | ex:F344N,F 344/N,An inbred strain of rat used in many scientific investigations.,James A. Overton,http://www.informatics.jax.org/external/festing/rat/docs/F344.shtml,James A. Overton,class,NCBITaxon:10116,,,, 4 | ex:B6C3F1,B6C3F1,An inbred strain of mouse used in many scientific investigations.,James A. Overton,http://jaxmice.jax.org/strain/100010.html,James A. Overton,class,NCBITaxon:10090,F 344/N,,, 5 | ex:propery-1,weight in kilograms,Weight of a mouse or rat in kilograms (kg).,Rebecca C Jackson,,Rebecca C Jackson,data property,,,'F 344/N' or B6C3F1,xsd:decimal, 6 | ex:rat-1234,rat 1234,,,,,F 344/N,,,,,0.2^^xsd:decimal -------------------------------------------------------------------------------- /.github/workflows/java-ci.yml: -------------------------------------------------------------------------------- 1 | name: Java CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | strategy: 15 | matrix: 16 | java: [11, 15, 17] 17 | 18 | name: Java ${{ matrix.java }} 19 | steps: 20 | - uses: actions/checkout@v2 21 | - name: Check Docs 22 | run: ./util/check_docs.py 23 | - name: Set up JDK 24 | uses: actions/setup-java@v1 25 | with: 26 | java-version: ${{ matrix.java }} 27 | - name: CI Test 28 | run: mvn verify 29 | - name: Upload Artifact 30 | if: ${{ matrix.java == 11 }} 31 | uses: actions/upload-artifact@v2 32 | with: 33 | name: robot.jar 34 | path: bin/robot.jar 35 | retention-days: 90 36 | -------------------------------------------------------------------------------- /docs/report_queries/misused_obsolete_label.md: -------------------------------------------------------------------------------- 1 | # Misused Obsolete Label 2 | 3 | **Problem:** A non-deprecated class has the "obsolete" prefix. This may mean that a deprecated class is missing the `owl:deprecated` annotation, or that this prefix was added accidentally. 4 | 5 | **Solution:** Remove the "obsolete" prefix or add the `owl:deprecated` annotation. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX oboInOwl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { rdfs:label } 14 | ?entity ?property ?value . 15 | FILTER NOT EXISTS { ?entity owl:deprecated true } 16 | FILTER (?entity != oboInOwl:ObsoleteClass) 17 | FILTER regex(?value, "^obsolete", "i") 18 | FILTER (!isBlank(?entity)) 19 | } 20 | ORDER BY ?entity 21 | ``` 22 | -------------------------------------------------------------------------------- /robot-core/src/test/java/org/obolibrary/robot/RelaxOperationTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import java.io.IOException; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import org.junit.Test; 7 | import org.semanticweb.owlapi.model.OWLOntology; 8 | 9 | /** Tests for ReasonOperation. */ 10 | public class RelaxOperationTest extends CoreTest { 11 | 12 | /** 13 | * Test relaxation, basic case. 14 | * 15 | * @throws IOException on file problem 16 | */ 17 | @Test 18 | public void testRelax() throws IOException { 19 | OWLOntology ont = loadOntology("/relax_equivalence_axioms_test.obo"); 20 | 21 | Map options = new HashMap(); 22 | options.put("remove-redundant-subclass-axioms", "true"); 23 | 24 | RelaxOperation.relax(ont, options); 25 | assertIdentical("/relax_equivalence_axioms_relaxed.obo", ont); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/misused_obsolete_label.rq: -------------------------------------------------------------------------------- 1 | # # Misused Obsolete Label 2 | # 3 | # **Problem:** A non-deprecated class has the "obsolete" prefix. This may mean that a deprecated class is missing the `owl:deprecated` annotation, or that this prefix was added accidentally. 4 | # 5 | # **Solution:** Remove the "obsolete" prefix or add the `owl:deprecated` annotation. 6 | 7 | PREFIX owl: 8 | PREFIX oboInOwl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { rdfs:label } 13 | ?entity ?property ?value . 14 | FILTER NOT EXISTS { ?entity owl:deprecated true } 15 | FILTER (?entity != oboInOwl:ObsoleteClass) 16 | FILTER regex(?value, "^obsolete", "i") 17 | FILTER (!isBlank(?entity)) 18 | } 19 | ORDER BY ?entity 20 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple.json: -------------------------------------------------------------------------------- 1 | { 2 | "@context": { 3 | "resources": "https://github.com/ontodev/robot/robot-core/src/test/resources/", 4 | "simple": "resources:simple.owl#", 5 | "label": "rdfs:label", 6 | "parent": { 7 | "@id": "rdfs:subClassOf", 8 | "@type": "@id" 9 | } 10 | }, 11 | 12 | "@graph": [ 13 | { 14 | "@id": "resources:simple.owl", 15 | "@type": "owl:Ontology" 16 | }, 17 | { 18 | "@id": "simple:test1", 19 | "@type": "owl:Class", 20 | "label": [ 21 | {"@value": "test one"}, 22 | {"@value": "Test 1"} 23 | ] 24 | }, 25 | { 26 | "@id": "simple:test2", 27 | "@type": "owl:Class", 28 | "parent": "simple:test1" 29 | } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /docs/report_queries/multiple_equivalent_classes.md: -------------------------------------------------------------------------------- 1 | # Multiple Equivalent Classes 2 | 3 | **Problem:** A class has more than one asserted equivalent classes, anonymous or named. This is probably a mistake, as equivalent statements can be intersections. 4 | 5 | **Solution:** Combine the equivalent class statements. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX rdf: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { owl:equivalentClass } 13 | ?entity ?property ?value1 . 14 | ?entity ?property ?value2 . 15 | FILTER NOT EXISTS { 16 | ?value1 owl:unionOf ?x . 17 | } 18 | FILTER NOT EXISTS { 19 | ?value2 owl:unionOf ?x . 20 | } 21 | FILTER (?value1 != ?value2) 22 | FILTER (!isBlank(?entity)) 23 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 24 | } 25 | ORDER BY ?entity 26 | ``` 27 | -------------------------------------------------------------------------------- /docs/examples/foo.owl: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | test 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/examples/edit2.owl: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | test 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /docs/examples/merge.owl: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 16 | test 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/invalid_entity_uri.rq: -------------------------------------------------------------------------------- 1 | # # Invalid Entity URI 2 | # 3 | # **Problem:** OBO entities are formatted http://purl.obolibrary.org/obo/IDSPACE_0000000. This format is assumed by many OBO tools. Often, accidentally typos cause entity to be ignored during processing. 4 | # 5 | # **Solution:** Fix the entity OBO URI. 6 | 7 | PREFIX rdf: 8 | 9 | SELECT DISTINCT ?entity ?property ?value WHERE { 10 | ?entity rdf:type ?value . 11 | FILTER (!isBlank(?entity)) 12 | FILTER( 13 | STRSTARTS(str(?entity),"https://purl.obolibrary.org/obo/") || 14 | STRSTARTS(str(?entity),"http://purl.org/obo/") || 15 | STRSTARTS(str(?entity),"http://www.obofoundry.org/") || 16 | (STRSTARTS(str(?entity),"https://purl.obolibrary.org/") && regex(str(?entity),"http[:][/][/]purl[.]obolibrary[.]org[/][^o][^b][^o]")) 17 | ) 18 | } 19 | ORDER BY ?entity 20 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/multiple_equivalent_classes.rq: -------------------------------------------------------------------------------- 1 | # # Multiple Equivalent Classes 2 | # 3 | # **Problem:** A class has more than one asserted equivalent classes, anonymous or named. This is probably a mistake, as equivalent statements can be intersections. 4 | # 5 | # **Solution:** Combine the equivalent class statements. 6 | 7 | PREFIX owl: 8 | PREFIX rdf: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | VALUES ?property { owl:equivalentClass } 12 | ?entity ?property ?value1 . 13 | ?entity ?property ?value2 . 14 | FILTER NOT EXISTS { 15 | ?value1 owl:unionOf ?x . 16 | } 17 | FILTER NOT EXISTS { 18 | ?value2 owl:unionOf ?x . 19 | } 20 | FILTER (?value1 != ?value2) 21 | FILTER (!isBlank(?entity)) 22 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 23 | } 24 | ORDER BY ?entity 25 | -------------------------------------------------------------------------------- /docs/report_queries/duplicate_label.md: -------------------------------------------------------------------------------- 1 | # Duplicate Label 2 | 3 | **Problem:** Two different subjects have been assigned the same label. This causes ambiguity. 4 | 5 | **OBO Foundry Principle:** [12 - Naming Conventions](http://www.obofoundry.org/principles/fp-012-naming-conventions.html) 6 | 7 | **Solution:** Avoid ambiguity by assigning distinct labels to each subject. 8 | 9 | ```sparql 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property {rdfs:label} 15 | ?entity ?property ?value . 16 | ?entity2 ?property ?value . 17 | FILTER (?entity != ?entity2) 18 | FILTER (!isBlank(?entity)) 19 | FILTER (!isBlank(?entity2)) 20 | FILTER NOT EXISTS { ?entity owl:deprecated true . 21 | ?entity2 owl:deprecated true } 22 | } 23 | ORDER BY DESC(UCASE(str(?value))) 24 | ``` 25 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/duplicate_label.rq: -------------------------------------------------------------------------------- 1 | # # Duplicate Label 2 | # 3 | # **Problem:** Two different subjects have been assigned the same label. This causes ambiguity. 4 | # 5 | # **OBO Foundry Principle:** [12 - Naming Conventions](http://www.obofoundry.org/principles/fp-012-naming-conventions.html) 6 | # 7 | # **Solution:** Avoid ambiguity by assigning distinct labels to each subject. 8 | 9 | PREFIX owl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property {rdfs:label} 14 | ?entity ?property ?value . 15 | ?entity2 ?property ?value . 16 | FILTER (?entity != ?entity2) 17 | FILTER (!isBlank(?entity)) 18 | FILTER (!isBlank(?entity2)) 19 | FILTER NOT EXISTS { ?entity owl:deprecated true . 20 | ?entity2 owl:deprecated true } 21 | } 22 | ORDER BY DESC(UCASE(str(?value))) 23 | -------------------------------------------------------------------------------- /docs/report_queries/multiple_definitions.md: -------------------------------------------------------------------------------- 1 | # Multiple Definitions 2 | 3 | **Problem:** An entity has more than one definition or elucidation. This may cause confusion or misuse, and will prevent translation to OBO format (in case of multiple definitions). Excludes deprecated entities. 4 | 5 | **OBO Foundry Principle:** [6 - Textual Definitions](http://obofoundry.org/principles/fp-006-textual-definitions.html) 6 | 7 | **Solution:** Remove extra definitions. 8 | 9 | ```sparql 10 | PREFIX obo: 11 | PREFIX owl: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property { obo:IAO_0000115 15 | obo:IAO_0000600 } 16 | ?entity ?property ?value . 17 | ?entity ?property ?value2 . 18 | FILTER (?value != ?value2) 19 | FILTER NOT EXISTS { ?entity owl:deprecated true } 20 | FILTER (!isBlank(?entity)) 21 | } 22 | ORDER BY ?entity 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/report_queries/duplicate_label_synonym.md: -------------------------------------------------------------------------------- 1 | # Duplicate Label-Synonym 2 | 3 | **Problem:** An entity shares a label with an exact synonym. This causes ambiguity. Excludes deprecated entities. 4 | 5 | **Solution:** Avoid ambiguity by changing the exact synonym or label. 6 | 7 | ```sparql 8 | PREFIX obo: 9 | PREFIX oboInOwl: 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property { 15 | obo:IAO_0000118 16 | oboInOwl:hasExactSynonym 17 | } 18 | FILTER NOT EXISTS { ?entity owl:deprecated true } 19 | FILTER NOT EXISTS { ?entity2 owl:deprecated true } 20 | ?entity rdfs:label ?value . 21 | ?entity2 ?property ?value . 22 | FILTER (!isBlank(?entity)) 23 | FILTER (!isBlank(?entity2)) 24 | } 25 | ORDER BY ?entity 26 | ``` 27 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/duplicate_label_synonym.rq: -------------------------------------------------------------------------------- 1 | # # Duplicate Label-Synonym 2 | # 3 | # **Problem:** An entity shares a label with an exact synonym. This causes ambiguity. Excludes deprecated entities. 4 | # 5 | # **Solution:** Avoid ambiguity by changing the exact synonym or label. 6 | 7 | PREFIX obo: 8 | PREFIX oboInOwl: 9 | PREFIX owl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { 14 | obo:IAO_0000118 15 | oboInOwl:hasExactSynonym 16 | } 17 | FILTER NOT EXISTS { ?entity owl:deprecated true } 18 | FILTER NOT EXISTS { ?entity2 owl:deprecated true } 19 | ?entity rdfs:label ?value . 20 | ?entity2 ?property ?value . 21 | FILTER (!isBlank(?entity)) 22 | FILTER (!isBlank(?entity2)) 23 | } 24 | ORDER BY ?entity -------------------------------------------------------------------------------- /docs/mirror.md: -------------------------------------------------------------------------------- 1 | # Mirror 2 | 3 | Many ontologies make use of `owl:imports` to bring in other ontologies, or portions of other ontologies. Large import chains involving multiple large ontologies are more prone to run-time failure due to network errors or latency. It can therefore be beneficial to "mirror", or cache an external ontology's import chain locally. This can be thought of as analogous to what happens with standard dependency management tools for software development. 4 | 5 | The following command will mirror the imports locally: 6 | 7 | robot mirror --input test.owl \ 8 | --directory results/my-cache \ 9 | --output results/my-catalog.xml 10 | 11 | This will generate a directory `results/my-cache/purl.obolibrary.org/obo/ro/` (based on the ontology IRI) with the imported ontologies as files. The file `my-catalog.xml` is a generated XML catalog mapping the source URIs to local files. -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/multiple_definitions.rq: -------------------------------------------------------------------------------- 1 | # # Multiple Definitions 2 | # 3 | # **Problem:** An entity has more than one definition or elucidation. This may cause confusion or misuse, and will prevent translation to OBO format (in case of multiple definitions). Excludes deprecated entities. 4 | # 5 | # **OBO Foundry Principle:** [6 - Textual Definitions](http://obofoundry.org/principles/fp-006-textual-definitions.html) 6 | # 7 | # **Solution:** Remove extra definitions. 8 | 9 | PREFIX obo: 10 | PREFIX owl: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { obo:IAO_0000115 14 | obo:IAO_0000600 } 15 | ?entity ?property ?value . 16 | ?entity ?property ?value2 . 17 | FILTER (?value != ?value2) 18 | FILTER NOT EXISTS { ?entity owl:deprecated true } 19 | FILTER (!isBlank(?entity)) 20 | } 21 | ORDER BY ?entity 22 | -------------------------------------------------------------------------------- /docs/examples/imports.owl: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/examples/imports-right.owl: -------------------------------------------------------------------------------- 1 | 2 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/reduce.md: -------------------------------------------------------------------------------- 1 | # Reduce 2 | 3 | ROBOT can be used to remove redundant subClassOf axioms: 4 | 5 | robot reduce --reasoner ELK \ 6 | --input ribosome.owl \ 7 | --output results/reduced.owl 8 | 9 | See [reason](/reason) for details on supported reasoners (EMR is not supported in `reduce`). 10 | 11 | Available options for `reduce`: 12 | * `--preserve-annotated-axioms`: if set to true, axioms that have axiom annotations will not be removed, even if found to be redundant (default `false`). 13 | * `--named-classes-only`: if set to true, only subclass axioms between named classes will be checked for redundancy. Anonymous class expressions will be ignored (default `false`). 14 | 15 | ### Warning 16 | 17 | Reciprocal subclass axioms (e.g. `A SubClassOf B`, `B SubClassOf A`), entailing equivalence between `A` and `B`, may be removed by `reduce`. In this case it is important to 18 | assert an equivalence axiom (`A EquivalentTo B`) using the `reason` command before running reduce. -------------------------------------------------------------------------------- /docs/report_queries/equivalent_class_axiom_no_genus.md: -------------------------------------------------------------------------------- 1 | # Equivalent Class Axiom with no Genus 2 | 3 | **Problem:** An equivalent class axiom of the kind C = R some A is nearly always an indication of a problem. It basically means that anything that is R related to an A is equal to the class. While this is sometimes legit, most often this is accidental. 4 | 5 | **Solution:** Add a genus to the class expression like: C = B and R some A. 6 | 7 | ``` 8 | PREFIX owl: 9 | PREFIX rdf: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | ?entity owl:equivalentClass [ rdf:type owl:Restriction ; 13 | owl:someValuesFrom ?value ; 14 | owl:onProperty ?property1 ] . 15 | FILTER (!isBlank(?entity)) 16 | FILTER (!isBlank(?value)) 17 | BIND (if(isIRI(?property1), ?property1, "blank node" ) as ?property) 18 | } 19 | ORDER BY ?entity 20 | 21 | ``` 22 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/relax_equivalence_axioms_expressions_materialized.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:1 5 | is_a: X:2 6 | intersection_of: X:2 7 | intersection_of: part_of X:3 8 | relationship: part_of X:3 9 | 10 | !! note in the following, there is no materialized 11 | !! superclasses; this is because cardinality axioms 12 | !! are invisible to Elk 13 | [Term] 14 | id: X:4 15 | intersection_of: X:5 16 | intersection_of: has_component X:6 {cardinality="2"} 17 | 18 | [Term] 19 | id: X:14 20 | intersection_of: X:15 21 | intersection_of: has_component X:16 {minCardinality="2"} 22 | 23 | [Term] 24 | id: X:24 25 | intersection_of: X:25 26 | intersection_of: has_component X:26 {maxCardinality="2"} 27 | 28 | [Term] 29 | id: X:34 30 | intersection_of: X:35 31 | intersection_of: has_component X:36 {maxCardinality="0"} 32 | 33 | [Typedef] 34 | id: part_of 35 | xref: BFO:0000050 36 | is_transitive: true 37 | 38 | [Typedef] 39 | id: has_component 40 | xref: RO:0002180 41 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/equivalent_class_axiom_no_genus.rq: -------------------------------------------------------------------------------- 1 | # # Equivalent Class Axiom with no Genus 2 | # 3 | # **Problem:** An equivalent class axiom of the kind C = R some A is nearly always an indication of a problem. It basically means that anything that is R related to an A is equal to the class. While this is sometimes legit, most often this is accidental. 4 | # 5 | # **Solution:** Add a genus to the class expression like: C = B and R some A. 6 | 7 | PREFIX owl: 8 | PREFIX rdf: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | ?entity owl:equivalentClass [ rdf:type owl:Restriction ; 12 | owl:someValuesFrom ?value ; 13 | owl:onProperty ?property1 ] . 14 | FILTER (!isBlank(?entity)) 15 | FILTER (!isBlank(?value)) 16 | BIND (if(isIRI(?property1), ?property1, "blank node" ) as ?property) 17 | } 18 | ORDER BY ?entity 19 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/1017-empty-label-input.owl: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 10 | 11 | 12 | Sample definition 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | E 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/report_queries/invalid_entity_uri.md: -------------------------------------------------------------------------------- 1 | # Invalid Entity URI 2 | 3 | **Problem:** An entity's URI is not formatted correctly. OBO entities are formatted http://purl.obolibrary.org/obo/IDSPACE_0000000. This format is assumed by many OBO tools. Often, accidental typos cause an entity to be malformed, which can cause problems for tools that deal with OBO ontologies. 4 | 5 | **Solution:** Fix the entity OBO URI. 6 | 7 | ``` 8 | PREFIX rdf: 9 | 10 | SELECT DISTINCT ?entity ?property ?value WHERE { 11 | ?entity rdf:type ?value . 12 | FILTER (!isBlank(?entity)) 13 | FILTER( 14 | STRSTARTS(str(?entity),"https://purl.obolibrary.org/obo/") || 15 | STRSTARTS(str(?entity),"http://purl.org/obo/") || 16 | STRSTARTS(str(?entity),"http://www.obofoundry.org/") || 17 | (STRSTARTS(str(?entity),"https://purl.obolibrary.org/") && regex(str(?entity),"http[:][/][/]purl[.]obolibrary[.]org[/][^o][^b][^o]")) 18 | ) 19 | } 20 | ORDER BY ?entity 21 | ``` 22 | -------------------------------------------------------------------------------- /docs/unmerge.md: -------------------------------------------------------------------------------- 1 | # Unmerge 2 | 3 | `unmerge` removes all axioms contained in one ontology from another. The first `--input` is the ontology to remove axioms from, subsequent `--input` ontologies contain the axioms to be removed: 4 | 5 | 6 | ``` 7 | robot unmerge --input my-ontology.owl \ 8 | --input remove-axioms.owl \ 9 | --input remove-axioms-2.owl \ 10 | --output my-ontology-fixed.owl 11 | ``` 12 | 13 | If any axioms exist in the subsequent ontologies that do not exist in the first ontology, they will be silently ignored. 14 | 15 | ### Unmerging a Merge 16 | 17 | A [merge](/merge) can be 'undone' using the unmerge command. This can be useful if we want to perform some operation (for example, reasoning) on a merged file, but later subtract the results. 18 | 19 | This will merge in foo, and then subtract out foo from the merged ontology. 20 | 21 | robot merge --input edit.owl \ 22 | --input foo.owl \ 23 | unmerge --input foo.owl \ 24 | --output results/unmerged.owl -------------------------------------------------------------------------------- /robot-core/src/test/resources/relax_equivalence_axioms_test.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:1 5 | intersection_of: X:2 6 | intersection_of: part_of X:3 7 | 8 | !! Note that cardinality axioms are invisible to Elk. 9 | !! The relax operation will unwind these into weaker 10 | !! but still valid SubClassOf axioms, utilizing only 11 | !! named classes and SomeValuesFrom expressions 12 | [Term] 13 | id: X:4 14 | intersection_of: X:5 15 | intersection_of: has_component X:6 {cardinality="2"} 16 | 17 | [Term] 18 | id: X:14 19 | intersection_of: X:15 20 | intersection_of: has_component X:16 {minCardinality="2"} 21 | 22 | [Term] 23 | id: X:24 24 | intersection_of: X:25 25 | intersection_of: has_component X:26 {maxCardinality="2"} 26 | 27 | [Term] 28 | id: X:34 29 | intersection_of: X:35 30 | intersection_of: has_component X:36 {maxCardinality="0"} 31 | 32 | [Typedef] 33 | id: part_of 34 | xref: BFO:0000050 35 | is_transitive: true 36 | 37 | [Typedef] 38 | id: has_component 39 | xref: RO:0002180 40 | 41 | -------------------------------------------------------------------------------- /docs/examples/nucleus.csv: -------------------------------------------------------------------------------- 1 | LABEL,SubClass Of,part of 2 | cell,cellular_component, 3 | cell part,cellular_component,cell 4 | cellular_component,, 5 | intracellular,cell part, 6 | intracellular membrane-bounded organelle,intracellular organelle|membrane-bounded organelle, 7 | intracellular organelle,intracellular part|organelle,intracellular 8 | intracellular organelle lumen,intracellular organelle part|organelle lumen,intracellular organelle 9 | intracellular organelle part,intracellular part|organelle part,intracellular|intracellular organelle|organelle 10 | intracellular part,cell part,intracellular 11 | membrane-bounded organelle,organelle, 12 | membrane-enclosed lumen,cellular_component, 13 | nuclear lumen,intracellular organelle lumen|nuclear part,nucleus 14 | nuclear part,intracellular organelle part,nucleus 15 | nucleus,intracellular membrane-bounded organelle, 16 | organelle,cellular_component, 17 | organelle lumen,membrane-enclosed lumen|organelle part,organelle 18 | organelle part,cellular_component,organelle 19 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/providers/IRIValueShortFormProvider.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.providers; 2 | 3 | import javax.annotation.Nonnull; 4 | import org.semanticweb.owlapi.model.OWLEntity; 5 | import org.semanticweb.owlapi.util.ShortFormProvider; 6 | 7 | /** 8 | * A short form provider that returns full IRIs. 9 | * 10 | * @author Becky Jackson 11 | */ 12 | public class IRIValueShortFormProvider implements ShortFormProvider { 13 | 14 | /** Create a new IRIValueShortFormProvider */ 15 | public IRIValueShortFormProvider() {} 16 | 17 | /** 18 | * Return the IRI of the entity as the short form. 19 | * 20 | * @param entity OWLEntity to get short form of 21 | * @return String IRI 22 | */ 23 | @Nonnull 24 | @Override 25 | public String getShortForm(@Nonnull OWLEntity entity) { 26 | return entity.getIRI().toString(); 27 | } 28 | 29 | /** Dispose of the short form provider. */ 30 | public void dispose() {} 31 | } 32 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple_parts_unmerged.owl: -------------------------------------------------------------------------------- 1 | Prefix(:=) 2 | Prefix(obo:=) 3 | Prefix(owl:=) 4 | Prefix(rdf:=) 5 | Prefix(xml:=) 6 | Prefix(xsd:=) 7 | Prefix(foaf:=) 8 | Prefix(rdfs:=) 9 | 10 | 11 | Ontology( 12 | Declaration(ObjectProperty()) 13 | SubClassOf( ObjectSomeValuesFrom( )) 14 | 15 | 16 | ) 17 | -------------------------------------------------------------------------------- /bin/robot: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## Check for Cygwin, use grep for a case-insensitive search 4 | IS_CYGWIN="FALSE" 5 | if uname | grep -iq cygwin; then 6 | IS_CYGWIN="TRUE" 7 | fi 8 | 9 | # Variable to hold path to this script 10 | # Start by assuming it was the path invoked. 11 | ROBOT_SCRIPT="$0" 12 | 13 | # Handle resolving symlinks to this script. 14 | # Using ls instead of readlink, because bsd and gnu flavors 15 | # have different behavior. 16 | while [ -h "$ROBOT_SCRIPT" ] ; do 17 | ls=`ls -ld "$ROBOT_SCRIPT"` 18 | # Drop everything prior to -> 19 | link=`expr "$ls" : '.*-> \(.*\)$'` 20 | if expr "$link" : '/.*' > /dev/null; then 21 | ROBOT_SCRIPT="$link" 22 | else 23 | ROBOT_SCRIPT=`dirname "$ROBOT_SCRIPT"`/"$link" 24 | fi 25 | done 26 | 27 | # Directory that contains the this script 28 | DIR=$(dirname "$ROBOT_SCRIPT") 29 | 30 | if [ $IS_CYGWIN = "TRUE" ] 31 | then 32 | exec java $ROBOT_JAVA_ARGS -jar "$(cygpath -w $DIR/robot.jar)" "$@" 33 | else 34 | exec java $ROBOT_JAVA_ARGS -jar "$DIR/robot.jar" "$@" 35 | fi 36 | -------------------------------------------------------------------------------- /docs/report_queries/duplicate_definition.md: -------------------------------------------------------------------------------- 1 | # Duplicate Definition 2 | 3 | **Problem:** An entity shares an exact definition or elucidation with another entity. Excludes deprecated entities. 4 | 5 | **OBO Foundry Principle:** [6 - Textual Definitions](http://obofoundry.org/principles/fp-006-textual-definitions.html) 6 | 7 | **Solution:** Update the definition to reflect the entities, or determine if the entities are the same. 8 | 9 | ```sparql 10 | PREFIX obo: 11 | PREFIX owl: 12 | PREFIX rdfs: 13 | 14 | SELECT DISTINCT ?entity ?property ?value WHERE { 15 | VALUES ?property { obo:IAO_0000115 16 | obo:IAO_0000600 } 17 | ?entity ?property ?value . 18 | ?entity2 ?property ?value . 19 | FILTER NOT EXISTS { ?entity owl:deprecated true } 20 | FILTER NOT EXISTS { ?entity2 owl:deprecated true } 21 | FILTER (?entity != ?entity2) 22 | FILTER (!isBlank(?entity)) 23 | } 24 | ORDER BY DESC(UCASE(str(?value))) 25 | ``` 26 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/OntologyLogicException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | import java.util.Set; 4 | import org.semanticweb.owlapi.model.OWLEntity; 5 | 6 | /** 7 | * Ontology contains unsatisfiable classes, properties or inconsistencies. 8 | * 9 | * @author cjm 10 | */ 11 | public class OntologyLogicException extends Exception { 12 | 13 | /** */ 14 | private static final long serialVersionUID = 8211835056287159708L; 15 | 16 | /** 17 | * Throw a new OntologyLogicException with string message. 18 | * 19 | * @param s message 20 | */ 21 | public OntologyLogicException(String s) { 22 | super(s); 23 | } 24 | 25 | /** 26 | * Throw a new OntologyLogicException with a set of unsatisfiable classes or properties. 27 | * 28 | * @param unsatisfiable set of unsatisfiable classes or properties 29 | */ 30 | public OntologyLogicException(Set unsatisfiable) {} 31 | 32 | /** Default constructor */ 33 | public OntologyLogicException() {} 34 | } 35 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/providers/EmptyIRIShortFormProvider.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.providers; 2 | 3 | import javax.annotation.Nonnull; 4 | import org.semanticweb.owlapi.model.IRI; 5 | import org.semanticweb.owlapi.util.IRIShortFormProvider; 6 | 7 | /** 8 | * Implementation of IRIShortFormProvider that always returns an empty string. For use as an 9 | * alternative short form provider for the LABEL case in export, where nothing should be returned if 10 | * a label does not exist. 11 | * 12 | * @author Becky Jackson 13 | */ 14 | public class EmptyIRIShortFormProvider implements IRIShortFormProvider { 15 | 16 | private static final long serialVersionUID = -2486017661266962136L; 17 | 18 | /** 19 | * Return an empty string as the short form of an IRI. 20 | * 21 | * @param iri IRI to get short form of 22 | * @return empty string 23 | */ 24 | @Nonnull 25 | @Override 26 | public String getShortForm(@Nonnull IRI iri) { 27 | return ""; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /docs/report_queries/duplicate_exact_synonym.md: -------------------------------------------------------------------------------- 1 | # Duplicate Exact Synonym 2 | 3 | **Problem:** Two entities share an exact synonym. This causes ambiguity. Excludes deprecated entities. 4 | 5 | **Solution:** Avoid ambiguity by assigning unique exact synonyms or changing the exact synonym to a different annotation (e.g. broad synonym). 6 | 7 | ```sparql 8 | PREFIX obo: 9 | PREFIX oboInOwl: 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property { 15 | obo:IAO_0000118 16 | oboInOwl:hasExactSynonym 17 | } 18 | ?entity ?property ?value. 19 | ?entity2 ?property ?value . 20 | FILTER NOT EXISTS { ?entity owl:deprecated true } 21 | FILTER NOT EXISTS { ?entity2 owl:deprecated true } 22 | FILTER (?entity != ?entity2) 23 | FILTER (!isBlank(?entity)) 24 | FILTER (!isBlank(?entity2)) 25 | } 26 | ORDER BY DESC(UCASE(str(?value))) 27 | ``` 28 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/duplicate_definition.rq: -------------------------------------------------------------------------------- 1 | # # Duplicate Definition 2 | # 3 | # **Problem:** An entity shares an exact definition or elucidation with another entity. Excludes deprecated entities. 4 | # 5 | # **OBO Foundry Principle:** [6 - Textual Definitions](http://obofoundry.org/principles/fp-006-textual-definitions.html) 6 | # 7 | # **Solution:** Update the definition to reflect the entities, or determine if the entities are the same. 8 | 9 | PREFIX obo: 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | VALUES ?property { obo:IAO_0000115 15 | obo:IAO_0000600 } 16 | ?entity ?property ?value . 17 | ?entity2 ?property ?value . 18 | FILTER NOT EXISTS { ?entity owl:deprecated true } 19 | FILTER NOT EXISTS { ?entity2 owl:deprecated true } 20 | FILTER (?entity != ?entity2) 21 | FILTER (!isBlank(?entity)) 22 | } 23 | ORDER BY DESC(UCASE(str(?value))) 24 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/duplicate_exact_synonym.rq: -------------------------------------------------------------------------------- 1 | # # Duplicate Exact Synonym 2 | # 3 | # **Problem:** Two entities share an exact synonym. This causes ambiguity. Excludes deprecated entities. 4 | # 5 | # **Solution:** Avoid ambiguity by assigning unique exact synonyms or changing the exact synonym to a different annotation (e.g. broad synonym). 6 | 7 | PREFIX obo: 8 | PREFIX oboInOwl: 9 | PREFIX owl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { 14 | obo:IAO_0000118 15 | oboInOwl:hasExactSynonym 16 | } 17 | ?entity ?property ?value. 18 | ?entity2 ?property ?value . 19 | FILTER NOT EXISTS { ?entity owl:deprecated true } 20 | FILTER NOT EXISTS { ?entity2 owl:deprecated true } 21 | FILTER (?entity != ?entity2) 22 | FILTER (!isBlank(?entity)) 23 | FILTER (!isBlank(?entity2)) 24 | } 25 | ORDER BY DESC(UCASE(str(?value))) 26 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/providers/EmptyShortFormProvider.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.providers; 2 | 3 | import javax.annotation.Nonnull; 4 | import org.semanticweb.owlapi.model.OWLEntity; 5 | import org.semanticweb.owlapi.util.ShortFormProvider; 6 | 7 | /** 8 | * Implementation of ShortFormProvider that always returns an empty string. For use as an 9 | * alternative short form provider for the LABEL case in export, where nothing should be returned if 10 | * a label does not exist. 11 | * 12 | * @author Becky Jackson 13 | */ 14 | public class EmptyShortFormProvider implements ShortFormProvider { 15 | 16 | /** 17 | * Return an empty string as the short form of an entity. 18 | * 19 | * @param owlEntity OWLEntity to get short form of 20 | * @return empty string 21 | */ 22 | @Nonnull 23 | @Override 24 | public String getShortForm(@Nonnull OWLEntity owlEntity) { 25 | return ""; 26 | } 27 | 28 | /** Dispose of the provider. */ 29 | @Override 30 | public void dispose() {} 31 | } 32 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_profile.txt: -------------------------------------------------------------------------------- 1 | WARN annotation_whitespace 2 | ERROR deprecated_boolean_datatype 3 | ERROR deprecated_class_reference 4 | ERROR deprecated_property_reference 5 | ERROR duplicate_definition 6 | WARN duplicate_exact_synonym 7 | WARN duplicate_label_synonym 8 | ERROR duplicate_label 9 | WARN duplicate_scoped_synonym 10 | WARN equivalent_pair 11 | WARN equivalent_class_axiom_no_genus 12 | ERROR illegal_use_of_built_in_vocabulary 13 | WARN invalid_xref 14 | ERROR label_formatting 15 | ERROR label_whitespace 16 | INFO lowercase_definition 17 | WARN missing_definition 18 | ERROR missing_label 19 | WARN missing_obsolete_label 20 | ERROR missing_ontology_description 21 | ERROR missing_ontology_license 22 | ERROR missing_ontology_title 23 | WARN missing_subset_declaration 24 | INFO missing_superclass 25 | WARN missing_synonymtype_declaration 26 | ERROR misused_obsolete_label 27 | ERROR misused_replaced_by 28 | ERROR multiple_definitions 29 | WARN multiple_equivalent_classes 30 | ERROR multiple_equivalent_class_definitions 31 | ERROR multiple_labels 32 | WARN invalid_entity_uri -------------------------------------------------------------------------------- /robot-core/src/test/resources/relax_equivalence_axioms_relaxed.obo: -------------------------------------------------------------------------------- 1 | ontology: relax 2 | 3 | [Term] 4 | id: X:1 5 | is_a: X:2 6 | intersection_of: X:2 7 | intersection_of: part_of X:3 8 | relationship: part_of X:3 9 | 10 | !! Note that relaxed axioms are generated, even 11 | !! though the cardinality axiom is invisible to Elk 12 | [Term] 13 | id: X:4 14 | is_a: X:5 15 | intersection_of: X:5 16 | intersection_of: has_component X:6 {cardinality="2"} 17 | relationship: has_component X:6 18 | 19 | [Term] 20 | id: X:14 21 | is_a: X:15 22 | intersection_of: X:15 23 | intersection_of: has_component X:16 {minCardinality="2"} 24 | relationship: has_component X:16 25 | 26 | [Term] 27 | id: X:24 28 | is_a: X:25 29 | intersection_of: X:25 30 | intersection_of: has_component X:26 {maxCardinality="2"} 31 | relationship: has_component X:26 32 | 33 | [Term] 34 | id: X:34 35 | is_a: X:35 36 | intersection_of: X:35 37 | intersection_of: has_component X:36 {maxCardinality="0"} 38 | 39 | [Typedef] 40 | id: part_of 41 | xref: BFO:0000050 42 | is_transitive: true 43 | 44 | [Typedef] 45 | id: has_component 46 | xref: RO:0002180 47 | 48 | -------------------------------------------------------------------------------- /docs/report_queries/duplicate_scoped_synonym.md: -------------------------------------------------------------------------------- 1 | # Duplicate Scoped Synonyms 2 | 3 | **Problem:** An entity has duplicate synonyms with different properties (e.g. the same broad and related synonym). This causes ambiguity. 4 | 5 | **Solution:** Remove duplicate synonyms and determine the correct scope. 6 | 7 | ```sparql 8 | PREFIX obo: 9 | PREFIX oboInOwl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { 14 | obo:IAO_0000118 15 | oboInOwl:hasExactSynonym 16 | oboInOwl:hasBroadSynonym 17 | oboInOwl:hasRelatedSynonym 18 | oboInOwl:hasNarrowSynonym 19 | } 20 | VALUES ?property2 { 21 | obo:IAO_0000118 22 | oboInOwl:hasExactSynonym 23 | oboInOwl:hasBroadSynonym 24 | oboInOwl:hasRelatedSynonym 25 | oboInOwl:hasNarrowSynonym 26 | } 27 | ?entity ?property ?value . 28 | ?entity ?property2 ?value . 29 | FILTER (?property != ?property2) 30 | FILTER (!isBlank(?entity)) 31 | } 32 | ORDER BY ?entity 33 | ``` 34 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/duplicate_scoped_synonym.rq: -------------------------------------------------------------------------------- 1 | # # Duplicate Scoped Synonyms 2 | # 3 | # **Problem:** An entity has duplicate synonyms with different properties (e.g. the same broad and related synonym). This causes ambiguity. 4 | # 5 | # **Solution:** Remove duplicate synonyms and determine the correct scope. 6 | 7 | PREFIX obo: 8 | PREFIX oboInOwl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { 13 | obo:IAO_0000118 14 | oboInOwl:hasExactSynonym 15 | oboInOwl:hasBroadSynonym 16 | oboInOwl:hasRelatedSynonym 17 | oboInOwl:hasNarrowSynonym 18 | } 19 | VALUES ?property2 { 20 | obo:IAO_0000118 21 | oboInOwl:hasExactSynonym 22 | oboInOwl:hasBroadSynonym 23 | oboInOwl:hasRelatedSynonym 24 | oboInOwl:hasNarrowSynonym 25 | } 26 | ?entity ?property ?value . 27 | ?entity ?property2 ?value . 28 | FILTER (?property != ?property2) 29 | FILTER (!isBlank(?entity)) 30 | } 31 | ORDER BY ?entity 32 | -------------------------------------------------------------------------------- /docs/report_queries/missing_superclass.md: -------------------------------------------------------------------------------- 1 | # Missing Superclass 2 | 3 | **Problem:** A class does not have a superclass. This is not relevant for top-level classes, but may reveal orphaned children. Excludes deprecated entities. 4 | 5 | **Solution:** Make sure there are no orphaned children - if so, assert a parent. 6 | 7 | ```sparql 8 | PREFIX owl: 9 | PREFIX rdf: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property { rdfs:subClassOf } 14 | ?entity a owl:Class . 15 | FILTER (!isBlank(?entity)) . 16 | FILTER NOT EXISTS { ?entity ?property ?value } 17 | FILTER NOT EXISTS { ?entity owl:deprecated true } 18 | FILTER EXISTS { 19 | ?entity ?prop2 ?object . 20 | FILTER (?prop2 != rdf:type) 21 | FILTER (?prop2 != owl:equivalentClass) 22 | FILTER (?prop2 != owl:disjointWith) 23 | FILTER (?prop2 != owl:equivalentProperty) 24 | FILTER (?prop2 != owl:sameAs) 25 | FILTER (?prop2 != owl:differentFrom) 26 | FILTER (?prop2 != owl:inverseOf) 27 | } 28 | } 29 | ORDER BY ?entity 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/report_queries/multiple_asserted_superclasses.md: -------------------------------------------------------------------------------- 1 | # Multiple Asserted Superclasses 2 | 3 | **Problem:** A class has more than one asserted named parent. This filters any axioms with the `is_inferred true` annotation, but inferences may not always be annotated. Double check where the parent is coming from before making changes. 4 | 5 | **Solution:** Use logical axioms to infer dual parentage. 6 | 7 | ```sparql 8 | PREFIX oboInOwl: 9 | PREFIX owl: 10 | PREFIX rdfs: 11 | 12 | SELECT DISTINCT ?entity ?property ?value WHERE { 13 | VALUES ?property {rdfs:subClassOf} 14 | ?entity a owl:Class . 15 | ?entity ?property ?value . 16 | ?entity ?property ?value2 . 17 | FILTER (?value != ?value2) 18 | FILTER (!isBlank(?value)) 19 | FILTER (!isBlank(?value2)) 20 | FILTER NOT EXISTS { 21 | ?axiom owl:annotatedSource ?entity . 22 | ?axiom owl:annotatedTarget ?value . 23 | ?axiom owl:annotatedProperty rdfs:subClassOf . 24 | ?axiom oboInOwl:is_inferred ?inf . 25 | FILTER regex(str(?inf), "true") 26 | } 27 | } 28 | ORDER BY ?entity 29 | ``` 30 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_superclass.rq: -------------------------------------------------------------------------------- 1 | # # Missing Superclass 2 | # 3 | # **Problem:** A class does not have a superclass. This is not relevant for top-level classes, but may reveal orphaned children. Excludes deprecated entities. 4 | # 5 | # **Solution:** Make sure there are no orphaned children - if so, assert a parent. 6 | 7 | PREFIX owl: 8 | PREFIX rdf: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property { rdfs:subClassOf } 13 | ?entity a owl:Class . 14 | FILTER (!isBlank(?entity)) . 15 | FILTER NOT EXISTS { ?entity ?property ?value } 16 | FILTER NOT EXISTS { ?entity owl:deprecated true } 17 | FILTER EXISTS { 18 | ?entity ?prop2 ?object . 19 | FILTER (?prop2 != rdf:type) 20 | FILTER (?prop2 != owl:equivalentClass) 21 | FILTER (?prop2 != owl:disjointWith) 22 | FILTER (?prop2 != owl:equivalentProperty) 23 | FILTER (?prop2 != owl:sameAs) 24 | FILTER (?prop2 != owl:differentFrom) 25 | FILTER (?prop2 != owl:inverseOf) 26 | } 27 | } 28 | ORDER BY ?entity 29 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/multiple_asserted_superclasses.rq: -------------------------------------------------------------------------------- 1 | # # Multiple Asserted Superclasses 2 | # 3 | # **Problem:** A class has more than one asserted named parent. This filters any axioms with the `is_inferred true` annotation, but inferences may not always be annotated. Double check where the parent is coming from before making changes. 4 | # 5 | # **Solution:** Use logical axioms to infer dual parentage. 6 | 7 | PREFIX oboInOwl: 8 | PREFIX owl: 9 | PREFIX rdfs: 10 | 11 | SELECT DISTINCT ?entity ?property ?value WHERE { 12 | VALUES ?property {rdfs:subClassOf} 13 | ?entity a owl:Class . 14 | ?entity ?property ?value . 15 | ?entity ?property ?value2 . 16 | FILTER (?value != ?value2) 17 | FILTER (!isBlank(?value)) 18 | FILTER (!isBlank(?value2)) 19 | FILTER NOT EXISTS { 20 | ?axiom owl:annotatedSource ?entity . 21 | ?axiom owl:annotatedTarget ?value . 22 | ?axiom owl:annotatedProperty rdfs:subClassOf . 23 | ?axiom oboInOwl:is_inferred ?inf . 24 | FILTER regex(str(?inf), "true") 25 | } 26 | } 27 | ORDER BY ?entity 28 | -------------------------------------------------------------------------------- /robot-core/src/test/java/org/obolibrary/robot/UnmergeOperationTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import java.io.IOException; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | import org.junit.Test; 7 | import org.semanticweb.owlapi.model.OWLOntology; 8 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; 9 | 10 | /** Tests for UnmergeOperation. */ 11 | public class UnmergeOperationTest extends CoreTest { 12 | 13 | /** 14 | * Test unmerging two ontologies without imports. Result should equal simpleParts. 15 | * 16 | * @throws IOException on file problem 17 | * @throws OWLOntologyCreationException on ontology problem 18 | */ 19 | @Test 20 | public void testUnmergeTwo() throws IOException, OWLOntologyCreationException { 21 | OWLOntology simple = loadOntology("/simple.owl"); 22 | OWLOntology simpleParts = loadOntology("/simple_parts.owl"); 23 | List ontologies = new ArrayList(); 24 | ontologies.add(simpleParts); 25 | ontologies.add(simple); 26 | OWLOntology unmerged = UnmergeOperation.unmerge(ontologies); 27 | assertIdentical("/simple_parts_unmerged.owl", unmerged); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/validate-table-template.jinja2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {% for cell in headerRow %} 5 | 8 | {% endfor %} 9 | 10 | 11 | 12 | 13 | {% for cell in rulesRow %} 14 | 17 | {% endfor %} 18 | 19 | 20 | {% for row in dataRows %} 21 | 22 | {% for cell in row %} 23 | 30 | {% endfor %} 31 | 32 | {% endfor %} 33 |
6 | {{ cell }} 7 |
15 | {{ cell }} 16 |
27 | {{ cell.content }} 28 | 29 |
34 | -------------------------------------------------------------------------------- /docs/examples/imports-nucleus.owl: -------------------------------------------------------------------------------- 1 | @prefix : . 2 | @prefix owl: . 3 | @prefix rdf: . 4 | @prefix xml: . 5 | @prefix xsd: . 6 | @prefix rdfs: . 7 | @base . 8 | 9 | rdf:type owl:Ontology ; 10 | owl:imports . 11 | 12 | ################################################################# 13 | # Classes 14 | ################################################################# 15 | 16 | ### http://purl.obolibrary.org/obo/GO_0005739 17 | rdf:type owl:Class ; 18 | rdfs:subClassOf ; 19 | rdfs:label "mitochondrion" . 20 | 21 | 22 | ### Generated by the OWL API (version 4.2.8.20170104-2310) https://github.com/owlcs/owlapi 23 | -------------------------------------------------------------------------------- /docs/examples/uvula_inconsistent_explanation.md: -------------------------------------------------------------------------------- 1 | ## [Thing](http://www.w3.org/2002/07/owl#Thing) SubClassOf [Nothing](http://www.w3.org/2002/07/owl#Nothing) ## 2 | 3 | - [uvular muscle](http://purl.obolibrary.org/obo/UBERON_0010235) SubClassOf [palatal muscle](http://purl.obolibrary.org/obo/UBERON_0003682) 4 | - [inconsistent_entity](http://purl.obolibrary.org/obo/CL_0017514) Type [uvular muscle](http://purl.obolibrary.org/obo/UBERON_0010235) 5 | - [palatal muscle](http://purl.obolibrary.org/obo/UBERON_0003682) DisjointWith [uvular muscle](http://purl.obolibrary.org/obo/UBERON_0010235) 6 | 7 | # Axiom Impact 8 | ## Axioms used 1 times 9 | - [uvular muscle](http://purl.obolibrary.org/obo/UBERON_0010235) SubClassOf [palatal muscle](http://purl.obolibrary.org/obo/UBERON_0003682) [uberon-base.owl] 10 | - [palatal muscle](http://purl.obolibrary.org/obo/UBERON_0003682) DisjointWith [uvular muscle](http://purl.obolibrary.org/obo/UBERON_0010235) [uberon-base.owl] 11 | - [inconsistent_entity](http://purl.obolibrary.org/obo/CL_0017514) Type [uvular muscle](http://purl.obolibrary.org/obo/UBERON_0010235) [uberon-base.owl] 12 | 13 | 14 | 15 | # Ontologies used: 16 | - uberon-base.owl (http://purl.obolibrary.org/obo/uberon/uberon-base.owl) 17 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/1016-report-json-failure/output.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "level": "ERROR", 4 | "violations": [ 5 | { 6 | "missing_label": [ 7 | { 8 | "subject": "http://test.org/test#A" 9 | } 10 | ] 11 | }, 12 | { 13 | "missing_ontology_description": [ 14 | { 15 | "subject": "http://test.org/test" 16 | } 17 | ] 18 | }, 19 | { 20 | "missing_ontology_license": [ 21 | { 22 | "subject": "http://test.org/test" 23 | } 24 | ] 25 | }, 26 | { 27 | "missing_ontology_title": [ 28 | { 29 | "subject": "http://test.org/test" 30 | } 31 | ] 32 | } 33 | ] 34 | }, 35 | { 36 | "level": "WARN" 37 | }, 38 | { 39 | "level": "INFO", 40 | "violations": [ 41 | { 42 | "lowercase_definition": [ 43 | { 44 | "subject": "http://test.org/test#A", 45 | "property": "IAO:0000115", 46 | "values": [ 47 | "skos:Concept interferes with \"quoted text\"" 48 | ] 49 | } 50 | ] 51 | } 52 | ] 53 | } 54 | ] -------------------------------------------------------------------------------- /docs/examples/named_graph.csv: -------------------------------------------------------------------------------- 1 | s 2 | http://purl.obolibrary.org/obo/UBERON_0000061 3 | http://purl.obolibrary.org/obo/UBERON_0000062 4 | http://purl.obolibrary.org/obo/UBERON_0000064 5 | http://purl.obolibrary.org/obo/UBERON_0000465 6 | http://purl.obolibrary.org/obo/UBERON_0000467 7 | http://purl.obolibrary.org/obo/UBERON_0000468 8 | http://purl.obolibrary.org/obo/UBERON_0000475 9 | http://purl.obolibrary.org/obo/UBERON_0000480 10 | http://purl.obolibrary.org/obo/UBERON_0000916 11 | http://purl.obolibrary.org/obo/UBERON_0000949 12 | http://purl.obolibrary.org/obo/UBERON_0001062 13 | http://purl.obolibrary.org/obo/UBERON_0001235 14 | http://purl.obolibrary.org/obo/UBERON_0001851 15 | http://purl.obolibrary.org/obo/UBERON_0002100 16 | http://purl.obolibrary.org/obo/UBERON_0002368 17 | http://purl.obolibrary.org/obo/UBERON_0002369 18 | http://purl.obolibrary.org/obo/UBERON_0002417 19 | http://purl.obolibrary.org/obo/UBERON_0002530 20 | http://purl.obolibrary.org/obo/UBERON_0006858 21 | http://purl.obolibrary.org/obo/UBERON_0009569 22 | http://purl.obolibrary.org/obo/UBERON_0010000 23 | http://purl.obolibrary.org/obo/UBERON_0011676 24 | http://purl.obolibrary.org/obo/UBERON_0013701 25 | http://purl.obolibrary.org/obo/UBERON_0013702 26 | -------------------------------------------------------------------------------- /docs/examples/my-base-report.tsv: -------------------------------------------------------------------------------- 1 | Level Rule Name Subject Property Value 2 | ERROR missing_ontology_description https://github.com/ontodev/robot/examples/edit.owl dc11:description 3 | ERROR missing_ontology_license https://github.com/ontodev/robot/examples/edit.owl dc:license 4 | ERROR missing_ontology_title https://github.com/ontodev/robot/examples/edit.owl dc11:title 5 | WARN annotation_whitespace obo:UBPROP_0000007 IAO:0000232 Used to connect a class to an adjectival form of its label. For example, a class with label 'intestine' may have a relational adjective 'intestinal'. 6 | WARN duplicate_label_synonym UBERON:0000949 oboInOwl:hasExactSynonym endocrine system 7 | WARN duplicate_label_synonym UBERON:0001851 oboInOwl:hasExactSynonym cortex 8 | WARN missing_definition UBERON:0009569 IAO:0000115 9 | WARN missing_definition obo:UBPROP_0000007 IAO:0000115 10 | WARN duplicate_scoped_synonym UBERON:0002368 oboInOwl:hasExactSynonym ductless gland 11 | WARN duplicate_scoped_synonym UBERON:0002368 oboInOwl:hasRelatedSynonym ductless gland 12 | WARN duplicate_scoped_synonym UBERON:0002369 oboInOwl:hasExactSynonym glandula suprarenalis 13 | WARN duplicate_scoped_synonym UBERON:0002369 oboInOwl:hasRelatedSynonym glandula suprarenalis 14 | INFO missing_superclass UBERON:0001062 rdfs:subClassOf 15 | -------------------------------------------------------------------------------- /docs/materialize.md: -------------------------------------------------------------------------------- 1 | # Materialize 2 | 3 | Robot can materialize inferred superclasses and superclass expressions using the expression materializing reasoner, which wraps an existing OWL Reasoner 4 | 5 | robot materialize --reasoner ELK \ 6 | --input emr_example.obo \ 7 | --term BFO:0000050 \ 8 | --output results/emr_output.obo 9 | 10 | This operation is similar to the reason command, but will also assert parents of the form `P some D`, for all P (properties) in the set passed in via `--term` or `--term-file`. 11 | 12 | This can be [chained](/chaining) with [remove](/remove) and [reduce](/reduce) to create a complete ontology subset. First, `materialize` asserts the inferred superclass expressions. Then, `remove` takes out any object properties (and the axioms that they are used in) that we do not need in the subset. Finally, `reduce` removes any duplicated axioms created by `materialize`. 13 | 14 | robot materialize --reasoner ELK \ 15 | --input emr_example.obo \ 16 | remove --term BFO:0000050 --trim true \ 17 | --select complement --select object-properties \ 18 | reduce --output results/emr_reduced.obo 19 | 20 | See [reason](/reason) for details on supported reasoners (EMR is not supported in `materialize`, as it is used to wrap another reasoner here). 21 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/reason/InferredClassAssertionAxiomGeneratorDirectOnly.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.reason; 2 | 3 | import java.util.Set; 4 | import javax.annotation.Nonnull; 5 | import org.semanticweb.owlapi.model.OWLClass; 6 | import org.semanticweb.owlapi.model.OWLClassAssertionAxiom; 7 | import org.semanticweb.owlapi.model.OWLDataFactory; 8 | import org.semanticweb.owlapi.model.OWLNamedIndividual; 9 | import org.semanticweb.owlapi.reasoner.OWLReasoner; 10 | import org.semanticweb.owlapi.util.InferredIndividualAxiomGenerator; 11 | 12 | /** An InferredAxiomGenerator which returns only direct class assettion axioms. */ 13 | public class InferredClassAssertionAxiomGeneratorDirectOnly 14 | extends InferredIndividualAxiomGenerator { 15 | 16 | @Override 17 | protected void addAxioms( 18 | @Nonnull OWLNamedIndividual entity, 19 | @Nonnull OWLReasoner reasoner, 20 | @Nonnull OWLDataFactory dataFactory, 21 | @Nonnull Set result) { 22 | for (OWLClass type : reasoner.getTypes(entity, true).getFlattened()) { 23 | result.add(dataFactory.getOWLClassAssertionAxiom(type, entity)); 24 | } 25 | } 26 | 27 | @Override 28 | public String getLabel() { 29 | return "Class assertions (individual direct types)"; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/gci_example.obo: -------------------------------------------------------------------------------- 1 | ontology: gci_example 2 | 3 | [Term] 4 | id: UBERON:0001004 ! respiratory system 5 | name: respiratory system 6 | 7 | [Term] 8 | id: UBERON:0007827 ! external nose 9 | name: external nose 10 | relationship: part_of UBERON:0001004 {gci_relation="part_of", gci_filler="NCBITaxon:32523"} ! respiratory system 11 | 12 | [Term] 13 | id: NCBITaxon:32523 ! Tetrapoda 14 | name: Tetrapoda 15 | 16 | [Term] 17 | id: NCBITaxon:40674 ! Mammalia 18 | name: Mammalia 19 | is_a: NCBITaxon:32523 ! Tetrapoda 20 | 21 | [Term] 22 | id: FOO:1 23 | name: mammalian external node 24 | intersection_of: UBERON:0007827 ! external nose 25 | intersection_of: part_of NCBITaxon:40674 ! Mammalia 26 | 27 | [Typedef] 28 | id: bounding_layer_of 29 | name: bounding layer of 30 | xref: RO:0002007 31 | is_a: part_of ! part of 32 | 33 | [Typedef] 34 | id: part_of 35 | name: part of 36 | xref: BFO:0000050 37 | is_transitive: true 38 | is_a: overlaps ! overlaps 39 | inverse_of: has_part ! has_part 40 | 41 | [Typedef] 42 | id: has_part 43 | name: has_part 44 | xref: BFO:0000051 45 | is_transitive: true 46 | is_a: overlaps ! overlaps 47 | 48 | [Typedef] 49 | id: overlaps 50 | name: overlaps 51 | xref: RO:0002131 52 | holds_over_chain: has_part overlaps 53 | holds_over_chain: has_part part_of 54 | holds_over_chain: part_of part_of 55 | 56 | 57 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/reason/InferredObjectPropertyRangeAxiomGenerator.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.reason; 2 | 3 | import java.util.Set; 4 | import javax.annotation.Nonnull; 5 | import org.semanticweb.owlapi.model.*; 6 | import org.semanticweb.owlapi.reasoner.OWLReasoner; 7 | import org.semanticweb.owlapi.util.InferredObjectPropertyAxiomGenerator; 8 | 9 | /** 10 | * An InferredAxiomGenerator which returns both direct and indirect inferred object property range 11 | * axioms. 12 | */ 13 | public class InferredObjectPropertyRangeAxiomGenerator 14 | extends InferredObjectPropertyAxiomGenerator { 15 | 16 | @Override 17 | protected void addAxioms( 18 | @Nonnull OWLObjectProperty entity, 19 | @Nonnull OWLReasoner reasoner, 20 | @Nonnull OWLDataFactory dataFactory, 21 | @Nonnull Set result, 22 | @Nonnull Set nonSimpleProperties) { 23 | for (OWLClass range : reasoner.getObjectPropertyRanges(entity, true).getFlattened()) { 24 | if (!range.isOWLThing()) { 25 | result.add(dataFactory.getOWLObjectPropertyRangeAxiom(entity, range)); 26 | } 27 | } 28 | } 29 | 30 | @Override 31 | public String getLabel() { 32 | return "Inferred object property range axioms"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /docs/examples/nucleus-reversed.csv: -------------------------------------------------------------------------------- 1 | ID,LABEL,SubClass Of 2 | GO:0044422,organelle part,'part of' some organelle|cellular_component 3 | GO:0043233,organelle lumen,'part of' some organelle|membrane-enclosed lumen|organelle part 4 | GO:0043226,organelle,cellular_component 5 | GO:0005634,nucleus,intracellular membrane-bounded organelle 6 | GO:0044428,nuclear part,'part of' some nucleus|intracellular organelle part 7 | GO:0031981,nuclear lumen,'part of' some nucleus|intracellular organelle lumen|nuclear part 8 | GO:0031974,membrane-enclosed lumen,cellular_component 9 | GO:0043227,membrane-bounded organelle,organelle 10 | GO:0044424,intracellular part,'part of' some intracellular|cell part 11 | GO:0044446,intracellular organelle part,'part of' some 'intracellular organelle'|'part of' some intracellular|'part of' some organelle|intracellular part|organelle part 12 | GO:0070013,intracellular organelle lumen,'part of' some 'intracellular organelle'|intracellular organelle part|organelle lumen 13 | GO:0043229,intracellular organelle,'part of' some intracellular|intracellular part|organelle 14 | GO:0043231,intracellular membrane-bounded organelle,intracellular organelle|membrane-bounded organelle 15 | GO:0005622,intracellular,cell part 16 | GO:0005575,cellular_component, 17 | GO:0044464,cell part,'part of' some cell|cellular_component 18 | GO:0005623,cell,cellular_component 19 | -------------------------------------------------------------------------------- /docs/examples/nucleus-sorted.csv: -------------------------------------------------------------------------------- 1 | ID,LABEL,SubClass Of 2 | GO:0044446,intracellular organelle part,'part of' some 'intracellular organelle'|'part of' some intracellular|'part of' some organelle|intracellular part|organelle part 3 | GO:0070013,intracellular organelle lumen,'part of' some 'intracellular organelle'|intracellular organelle part|organelle lumen 4 | GO:0044464,cell part,'part of' some cell|cellular_component 5 | GO:0044424,intracellular part,'part of' some intracellular|cell part 6 | GO:0043229,intracellular organelle,'part of' some intracellular|intracellular part|organelle 7 | GO:0031981,nuclear lumen,'part of' some nucleus|intracellular organelle lumen|nuclear part 8 | GO:0044428,nuclear part,'part of' some nucleus|intracellular organelle part 9 | GO:0044422,organelle part,'part of' some organelle|cellular_component 10 | GO:0043233,organelle lumen,'part of' some organelle|membrane-enclosed lumen|organelle part 11 | GO:0005622,intracellular,cell part 12 | GO:0005623,cell,cellular_component 13 | GO:0031974,membrane-enclosed lumen,cellular_component 14 | GO:0043226,organelle,cellular_component 15 | GO:0005634,nucleus,intracellular membrane-bounded organelle 16 | GO:0043231,intracellular membrane-bounded organelle,intracellular organelle|membrane-bounded organelle 17 | GO:0043227,membrane-bounded organelle,organelle 18 | GO:0005575,cellular_component, 19 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/reason-direct-indirect.ofn: -------------------------------------------------------------------------------- 1 | Prefix(:=) 2 | Prefix(owl:=) 3 | Prefix(rdf:=) 4 | Prefix(xml:=) 5 | Prefix(xsd:=) 6 | Prefix(rdfs:=) 7 | 8 | 9 | Ontology( 10 | 11 | Declaration(Class(:A)) 12 | Declaration(Class(:B)) 13 | Declaration(Class(:C)) 14 | Declaration(Class(:D)) 15 | Declaration(ObjectProperty(:r)) 16 | Declaration(ObjectProperty(:s)) 17 | Declaration(ObjectProperty(:t)) 18 | Declaration(NamedIndividual(:c)) 19 | ############################ 20 | # Object Properties 21 | ############################ 22 | 23 | # Object Property: :s (:s) 24 | 25 | SubObjectPropertyOf(:s :r) 26 | 27 | # Object Property: :t (:t) 28 | 29 | SubObjectPropertyOf(:t :s) 30 | 31 | 32 | ############################ 33 | # Classes 34 | ############################ 35 | 36 | # Class: :B (:B) 37 | 38 | EquivalentClasses(:B ObjectIntersectionOf(:A :D)) 39 | 40 | # Class: :C (:C) 41 | 42 | SubClassOf(:C ObjectIntersectionOf(:B :D)) 43 | 44 | 45 | ############################ 46 | # Named Individuals 47 | ############################ 48 | 49 | # Individual: :c (:c) 50 | 51 | ClassAssertion(:C :c) 52 | 53 | 54 | ) -------------------------------------------------------------------------------- /docs/export-prefixes.md: -------------------------------------------------------------------------------- 1 | # Export Prefixes 2 | 3 | You can print or save the current [prefixes](/global#prefixes) using the `export-prefixes` command: 4 | 5 | robot --prefixes foo.json \ 6 | --prefix "bar: http://bar#" \ 7 | --prefix "baz: http://baz#" \ 8 | export-prefixes 9 | 10 | This prints the [default prefixes](https://github.com/ontodev/robot/blob/master/robot-core/src/main/resources/obo_context.jsonld) *plus* the user-added prefixes in [JSON-LD format](https://json-ld.org/) The prefixes are contained within a `@context` that can be used to resolve [JSON-LD compact IRIs](https://www.w3.org/TR/json-ld/#compact-iris). For the above, command, the printed output would look something like: 11 | 12 | ``` 13 | { 14 | "@context": { 15 | "obo": "http://purl.obolibrary.org/obo/", 16 | "oboInOwl": "http://www.geneontology.org/formats/oboInOwl#", 17 | ... 18 | "foo": "http://foo#", 19 | "bar": "http://bar#", 20 | "baz": "http://baz#" 21 | } 22 | } 23 | ``` 24 | 25 | You can also include an output to write the prefixes to a file: 26 | 27 | robot --noprefixes --prefix "foo: http://foo#" \ 28 | export-prefixes --output results/foo.json 29 | 30 | The `--noprefixes` flag is used in this example, meaning the default prefixes are not included. For more details on adding prefixes, see [prefixes](/global#prefixes). 31 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/reason/InferredObjectPropertyDomainAxiomGenerator.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.reason; 2 | 3 | import java.util.Set; 4 | import javax.annotation.Nonnull; 5 | import org.semanticweb.owlapi.model.*; 6 | import org.semanticweb.owlapi.reasoner.OWLReasoner; 7 | import org.semanticweb.owlapi.util.InferredObjectPropertyAxiomGenerator; 8 | 9 | /** 10 | * An InferredAxiomGenerator which returns both direct and indirect inferred object property domain 11 | * axioms. 12 | */ 13 | public class InferredObjectPropertyDomainAxiomGenerator 14 | extends InferredObjectPropertyAxiomGenerator { 15 | 16 | @Override 17 | protected void addAxioms( 18 | @Nonnull OWLObjectProperty entity, 19 | @Nonnull OWLReasoner reasoner, 20 | @Nonnull OWLDataFactory dataFactory, 21 | @Nonnull Set result, 22 | @Nonnull Set nonSimpleProperties) { 23 | for (OWLClass domain : reasoner.getObjectPropertyDomains(entity, true).getFlattened()) { 24 | if (!domain.isOWLThing()) { 25 | result.add(dataFactory.getOWLObjectPropertyDomainAxiom(entity, domain)); 26 | } 27 | } 28 | } 29 | 30 | @Override 31 | public String getLabel() { 32 | return "Inferred object property domain axioms"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /docs/chaining.md: -------------------------------------------------------------------------------- 1 | # Chaining 2 | 3 | On Unix platforms it's common to "chain" a series of commands, creating "pipeline" that combines several simple commands to accomplish a complex task. This works because most Unix tools communicate with streams of text. Unfortunately this doesn't work as well for OWL ontologies, because they cannot be streamed between commands, but we can achieve a similar result within ROBOT. 4 | 5 | ROBOT allows several commands to be chained by using the output ontology as the input to the next step. Here's an example of a full release pipeline using chained commands: 6 | 7 | robot \ 8 | merge --input edit.owl \ 9 | reason --reasoner ELK \ 10 | annotate --annotation-file annotations.ttl --output results/example.owl \ 11 | convert --output results/example.obo 12 | 13 | Each command has been put on its own line, for clarity. Only the first command has an explicit `--input` argument. The following commands use the output of the previous command as their input. Also notice that the first two commands do not specify an `--output` file. Their output is not saved to the filesystem, only sent to the next command. But the last two commands both specify `--output` files, and their results are saved to different files. 14 | 15 | Chained commands are powerful but can be tedious to write out. Consider putting them in a Makefile. 16 | -------------------------------------------------------------------------------- /docs/examples/uvular_unsat_explanation.ofn: -------------------------------------------------------------------------------- 1 | Prefix(:=) 2 | Prefix(owl:=) 3 | Prefix(rdf:=) 4 | Prefix(xml:=) 5 | Prefix(xsd:=) 6 | Prefix(rdfs:=) 7 | 8 | 9 | Ontology( 10 | Annotation(rdfs:label "Explanation for unsatisfiability of Uvular Muscle") 11 | 12 | Declaration(Class()) 13 | Declaration(Class()) 14 | 15 | 16 | ############################ 17 | # Classes 18 | ############################ 19 | 20 | # Class: (palatal muscle) 21 | 22 | AnnotationAssertion(rdfs:label "palatal muscle") 23 | DisjointClasses( ) 24 | 25 | # Class: (uvular muscle) 26 | 27 | AnnotationAssertion(rdfs:label "uvular muscle") 28 | SubClassOf( ) 29 | 30 | 31 | ) -------------------------------------------------------------------------------- /robot-core/src/test/resources/rename_partial.owl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | test one 29 | Test 1 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /docs/validate-profile.md: -------------------------------------------------------------------------------- 1 | # Validate Profile 2 | 3 | OWL 2 has a number of profiles that strike different balances between expressive power and reasoning efficiency. ROBOT can validate an input ontology against a profile (EL, DL, RL, QL, and Full) and generate a report. For example: 4 | 5 | robot validate-profile --profile EL \ 6 | --input merged.owl \ 7 | --output results/merged-validation.txt 8 | 9 | ## Profiles 10 | 11 | * EL 12 | * RL 13 | * QL 14 | * DL 15 | * Full 16 | 17 | --- 18 | 19 | ## Error Messages 20 | 21 | ### Missing Profile Error 22 | 23 | Occurs when a `--profile` option is not provided. 24 | 25 | ### Invalid Profile Error 26 | 27 | Occurs when the argument to `--profile` is not one of the following: EL, DL, RL, QL, or Full. See the above documentation for more details. 28 | 29 | ### Profile Violation Error 30 | 31 | Occurs when the `--input` ontology does not conform to the `--profile`. See the profile descriptions for more details. 32 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/reason/InferredSubClassAxiomGeneratorIncludingIndirect.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.reason; 2 | 3 | import java.util.Set; 4 | import javax.annotation.Nonnull; 5 | import org.semanticweb.owlapi.model.OWLClass; 6 | import org.semanticweb.owlapi.model.OWLDataFactory; 7 | import org.semanticweb.owlapi.model.OWLSubClassOfAxiom; 8 | import org.semanticweb.owlapi.reasoner.OWLReasoner; 9 | import org.semanticweb.owlapi.util.InferredClassAxiomGenerator; 10 | 11 | /** An InferredAxiomGenerator which returns both direct and indirect inferred subclass axioms. */ 12 | public class InferredSubClassAxiomGeneratorIncludingIndirect 13 | extends InferredClassAxiomGenerator { 14 | 15 | @Override 16 | protected void addAxioms( 17 | @Nonnull OWLClass entity, 18 | @Nonnull OWLReasoner reasoner, 19 | @Nonnull OWLDataFactory dataFactory, 20 | @Nonnull Set result) { 21 | if (reasoner.isSatisfiable(entity)) { 22 | for (OWLClass superclass : reasoner.getSuperClasses(entity, false).getFlattened()) { 23 | result.add(dataFactory.getOWLSubClassOfAxiom(entity, superclass)); 24 | } 25 | } else { 26 | result.add(dataFactory.getOWLSubClassOfAxiom(entity, dataFactory.getOWLNothing())); 27 | } 28 | } 29 | 30 | @Override 31 | public String getLabel() { 32 | return "Subclasses including indirect"; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /docs/examples/mitochondrion.owl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | mitochondrion 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/gci_example_materialized.obo: -------------------------------------------------------------------------------- 1 | ontology: gci_example 2 | 3 | [Term] 4 | id: FOO:1 5 | name: mammalian external node 6 | is_a: UBERON:0007827 ! external nose 7 | intersection_of: UBERON:0007827 ! external nose 8 | intersection_of: part_of NCBITaxon:40674 ! Mammalia 9 | relationship: part_of NCBITaxon:40674 ! Mammalia 10 | relationship: part_of UBERON:0001004 ! respiratory system 11 | 12 | [Term] 13 | id: NCBITaxon:32523 14 | name: Tetrapoda 15 | 16 | [Term] 17 | id: NCBITaxon:40674 18 | name: Mammalia 19 | is_a: NCBITaxon:32523 ! Tetrapoda 20 | 21 | [Term] 22 | id: UBERON:0001004 23 | name: respiratory system 24 | 25 | [Term] 26 | id: UBERON:0007827 27 | name: external nose 28 | relationship: part_of UBERON:0001004 {gci_relation="part_of", gci_filler="NCBITaxon:32523"} ! respiratory system 29 | 30 | [Typedef] 31 | id: bounding_layer_of 32 | name: bounding layer of 33 | xref: RO:0002007 34 | is_a: part_of ! part of 35 | 36 | [Typedef] 37 | id: has_part 38 | name: has_part 39 | xref: BFO:0000051 40 | is_transitive: true 41 | is_a: overlaps ! overlaps 42 | 43 | [Typedef] 44 | id: overlaps 45 | name: overlaps 46 | xref: RO:0002131 47 | holds_over_chain: has_part overlaps 48 | holds_over_chain: has_part part_of 49 | holds_over_chain: part_of part_of 50 | 51 | [Typedef] 52 | id: part_of 53 | name: part of 54 | xref: BFO:0000050 55 | is_transitive: true 56 | is_a: overlaps ! overlaps 57 | inverse_of: has_part ! has_part 58 | 59 | -------------------------------------------------------------------------------- /docs/examples/metrics_essential.json: -------------------------------------------------------------------------------- 1 | { 2 | "metrics": { 3 | "abox_axiom_count": 0, 4 | "abox_axiom_count_incl": 0, 5 | "annotation_property_count": 38, 6 | "annotation_property_count_incl": 38, 7 | "axiom_count": 5504, 8 | "axiom_count_incl": 5504, 9 | "class_count": 236, 10 | "class_count_incl": 236, 11 | "dataproperty_count": 0, 12 | "dataproperty_count_incl": 0, 13 | "datatypes_count": 2, 14 | "datatypes_count_incl": 2, 15 | "individual_count": 0, 16 | "individual_count_incl": 0, 17 | "logical_axiom_count": 828, 18 | "logical_axiom_count_incl": 828, 19 | "obj_property_count": 49, 20 | "obj_property_count_incl": 49, 21 | "ontology_anno_count": 0, 22 | "ontology_iri": "http://purl.obolibrary.org/obo/uberon.owl", 23 | "ontology_version_iri": "no.iri", 24 | "owl2": true, 25 | "owl2_dl": true, 26 | "owl2_el": false, 27 | "owl2_ql": false, 28 | "owl2_rl": false, 29 | "rbox_axiom_count": 56, 30 | "rbox_axiom_count_incl": 56, 31 | "rdfs": false, 32 | "rule_count": 0, 33 | "rule_count_incl": 0, 34 | "signature_entity_count": 325, 35 | "signature_entity_count_incl": 325, 36 | "tbox_axiom_count": 772, 37 | "tbox_axiom_count_incl": 772, 38 | "tboxrbox_axiom_count": 828, 39 | "tboxrbox_axiom_count_incl": 828, 40 | "valid_imports": [], 41 | "valid_imports_incl": [], 42 | "owl2dl_profile_violation": {} 43 | } 44 | } -------------------------------------------------------------------------------- /docs/report_queries/missing_label.md: -------------------------------------------------------------------------------- 1 | # Missing Label 2 | 3 | **Problem:** An entity does not have a label or the label is empty. This may cause confusion or misuse. Excludes deprecated entities. 4 | 5 | **OBO Foundry Principle:** [12 - Naming Conventions](http://www.obofoundry.org/principles/fp-012-naming-conventions.html) 6 | 7 | **Solution:** Add a label, or make it non-empty. 8 | 9 | ```sparql 10 | PREFIX owl: 11 | PREFIX rdf: 12 | PREFIX rdfs: 13 | PREFIX oboInOwl: 14 | 15 | SELECT DISTINCT ?entity ?property ?value WHERE { 16 | VALUES ?property { rdfs:label } 17 | ?entity ?any ?o . 18 | FILTER NOT EXISTS { 19 | ?entity ?property ?value . 20 | FILTER(str(?value) != "") 21 | } 22 | FILTER NOT EXISTS { ?entity a owl:Ontology } 23 | FILTER NOT EXISTS { ?entity owl:deprecated true } 24 | FILTER NOT EXISTS { 25 | ?entity rdfs:subPropertyOf oboInOwl:SubsetProperty . 26 | } 27 | FILTER EXISTS { 28 | ?entity ?prop2 ?object . 29 | FILTER (?prop2 != rdf:type) 30 | FILTER (?prop2 != owl:equivalentClass) 31 | FILTER (?prop2 != owl:disjointWith) 32 | FILTER (?prop2 != owl:equivalentProperty) 33 | FILTER (?prop2 != owl:sameAs) 34 | FILTER (?prop2 != owl:differentFrom) 35 | FILTER (?prop2 != owl:inverseOf) 36 | } 37 | FILTER (!isBlank(?entity)) 38 | } 39 | ORDER BY ?entity 40 | ``` 41 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_label.rq: -------------------------------------------------------------------------------- 1 | # # Missing Label 2 | # 3 | # **Problem:** An entity does not have a label or the label is empty. This may cause confusion or misuse. Excludes deprecated entities. 4 | # 5 | # **OBO Foundry Principle:** [12 - Naming Conventions](http://www.obofoundry.org/principles/fp-012-naming-conventions.html) 6 | # 7 | # **Solution:** Add a label, or make it non-empty. 8 | 9 | PREFIX owl: 10 | PREFIX rdf: 11 | PREFIX rdfs: 12 | PREFIX oboInOwl: 13 | 14 | SELECT DISTINCT ?entity ?property ?value WHERE { 15 | VALUES ?property { rdfs:label } 16 | ?entity ?any ?o . 17 | FILTER NOT EXISTS { 18 | ?entity ?property ?value . 19 | FILTER(str(?value) != "") 20 | } 21 | FILTER NOT EXISTS { ?entity a owl:Ontology } 22 | FILTER NOT EXISTS { ?entity owl:deprecated true } 23 | FILTER NOT EXISTS { 24 | ?entity rdfs:subPropertyOf oboInOwl:SubsetProperty . 25 | } 26 | FILTER EXISTS { 27 | ?entity ?prop2 ?object . 28 | FILTER (?prop2 != rdf:type) 29 | FILTER (?prop2 != owl:equivalentClass) 30 | FILTER (?prop2 != owl:disjointWith) 31 | FILTER (?prop2 != owl:equivalentProperty) 32 | FILTER (?prop2 != owl:sameAs) 33 | FILTER (?prop2 != owl:differentFrom) 34 | FILTER (?prop2 != owl:inverseOf) 35 | } 36 | FILTER (!isBlank(?entity)) 37 | } 38 | ORDER BY ?entity 39 | -------------------------------------------------------------------------------- /docs/examples/metrics.tsv: -------------------------------------------------------------------------------- 1 | metric metric_value metric_type 2 | abox_axiom_count 0 single_value 3 | abox_axiom_count_incl 0 single_value 4 | annotation_property_count 38 single_value 5 | annotation_property_count_incl 38 single_value 6 | axiom_count 5504 single_value 7 | axiom_count_incl 5504 single_value 8 | class_count 236 single_value 9 | class_count_incl 236 single_value 10 | dataproperty_count 0 single_value 11 | dataproperty_count_incl 0 single_value 12 | datatypes_count 2 single_value 13 | datatypes_count_incl 2 single_value 14 | individual_count 0 single_value 15 | individual_count_incl 0 single_value 16 | logical_axiom_count 828 single_value 17 | logical_axiom_count_incl 828 single_value 18 | obj_property_count 49 single_value 19 | obj_property_count_incl 49 single_value 20 | ontology_anno_count 0 single_value 21 | ontology_iri http://purl.obolibrary.org/obo/uberon.owl single_value 22 | ontology_version_iri no.iri single_value 23 | owl2 true single_value 24 | owl2_dl true single_value 25 | owl2_el false single_value 26 | owl2_ql false single_value 27 | owl2_rl false single_value 28 | rbox_axiom_count 56 single_value 29 | rbox_axiom_count_incl 56 single_value 30 | rdfs false single_value 31 | rule_count 0 single_value 32 | rule_count_incl 0 single_value 33 | signature_entity_count 325 single_value 34 | signature_entity_count_incl 325 single_value 35 | tbox_axiom_count 772 single_value 36 | tbox_axiom_count_incl 772 single_value 37 | tboxrbox_axiom_count 828 single_value 38 | tboxrbox_axiom_count_incl 828 single_value 39 | -------------------------------------------------------------------------------- /robot-core/src/test/java/org/obolibrary/robot/RenameOperationTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | import org.junit.Test; 6 | import org.semanticweb.owlapi.model.OWLOntology; 7 | 8 | /** Tests for RenameOperation. */ 9 | public class RenameOperationTest extends CoreTest { 10 | 11 | /** 12 | * Test renaming of full IRIs. 13 | * 14 | * @throws Exception on any problem 15 | */ 16 | @Test 17 | public void testFullRename() throws Exception { 18 | OWLOntology ont = loadOntology("/simple.owl"); 19 | Map mappings = new HashMap<>(); 20 | mappings.put( 21 | "https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl#test1", 22 | "http://foo.bar/test1"); 23 | 24 | RenameOperation.renameFull(ont, new IOHelper(), mappings, false); 25 | 26 | assertIdentical("/rename_full.owl", ont); 27 | } 28 | 29 | /** 30 | * Test renaming of partial IRIs. 31 | * 32 | * @throws Exception on any problem 33 | */ 34 | @Test 35 | public void testPartialRename() throws Exception { 36 | OWLOntology ont = loadOntology("/simple.owl"); 37 | Map mappings = new HashMap<>(); 38 | mappings.put( 39 | "https://github.com/ontodev/robot/robot-core/src/test/resources/simple.owl#", 40 | "http://foo.bar/"); 41 | 42 | RenameOperation.renamePrefixes(ont, new IOHelper(), mappings); 43 | 44 | assertIdentical("/rename_partial.owl", ont); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple_filtered.owl: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 13 | 14 | 15 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | Test 1 30 | test one 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/examples/metrics_essential_reasoner.json: -------------------------------------------------------------------------------- 1 | { 2 | "metrics": { 3 | "abox_axiom_count": 0, 4 | "abox_axiom_count_incl": 0, 5 | "annotation_property_count": 38, 6 | "annotation_property_count_incl": 38, 7 | "axiom_count": 5504, 8 | "axiom_count_incl": 5504, 9 | "class_count": 236, 10 | "class_count_incl": 236, 11 | "consistent": true, 12 | "dataproperty_count": 0, 13 | "dataproperty_count_incl": 0, 14 | "datatypes_count": 2, 15 | "datatypes_count_incl": 2, 16 | "individual_count": 0, 17 | "individual_count_incl": 0, 18 | "logical_axiom_count": 828, 19 | "logical_axiom_count_incl": 828, 20 | "obj_property_count": 49, 21 | "obj_property_count_incl": 49, 22 | "ontology_anno_count": 0, 23 | "ontology_iri": "http://purl.obolibrary.org/obo/uberon.owl", 24 | "ontology_version_iri": "no.iri", 25 | "owl2": true, 26 | "owl2_dl": true, 27 | "owl2_el": false, 28 | "owl2_ql": false, 29 | "owl2_rl": false, 30 | "rbox_axiom_count": 56, 31 | "rbox_axiom_count_incl": 56, 32 | "rdfs": false, 33 | "rule_count": 0, 34 | "rule_count_incl": 0, 35 | "signature_entity_count": 325, 36 | "signature_entity_count_incl": 325, 37 | "tbox_axiom_count": 772, 38 | "tbox_axiom_count_incl": 772, 39 | "tboxrbox_axiom_count": 828, 40 | "tboxrbox_axiom_count_incl": 828, 41 | "unsatisfiable_class_count": 0, 42 | "valid_imports": [], 43 | "valid_imports_incl": [], 44 | "owl2dl_profile_violation": {} 45 | } 46 | } -------------------------------------------------------------------------------- /robot-core/src/test/resources/rename_full.owl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | test one 29 | Test 1 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /robot-command/src/main/java/org/obolibrary/robot/ExtendedPosixParser.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import java.util.ListIterator; 4 | import org.apache.commons.cli.*; 5 | 6 | /** 7 | * A custom CommandLineParser that ignores unrecognized options without throwing an exception. See 8 | * http://stackoverflow.com/a/8613949 9 | */ 10 | @Deprecated 11 | @SuppressWarnings("deprecation") 12 | public class ExtendedPosixParser extends PosixParser { 13 | /** Flag for ignoring unrecognized options. */ 14 | private boolean ignoreUnrecognizedOption; 15 | 16 | /** 17 | * Extend constructor to accept ignore option. 18 | * 19 | * @param ignoreUnrecognizedOption when true, silently ignore unrecognized options 20 | */ 21 | @Deprecated 22 | public ExtendedPosixParser(final boolean ignoreUnrecognizedOption) { 23 | this.ignoreUnrecognizedOption = ignoreUnrecognizedOption; 24 | } 25 | 26 | /** 27 | * Given an argument string and an iterator, try to process the option, respecting the 28 | * ignoreUnrecognizedOption flag. 29 | * 30 | * @param arg the argument to process 31 | * @param iter the iterator for the super class to deal with 32 | * @throws ParseException on any problems 33 | */ 34 | @Deprecated 35 | @Override 36 | protected void processOption(final String arg, final ListIterator iter) 37 | throws ParseException { 38 | boolean hasOption = getOptions().hasOption(arg); 39 | 40 | if (hasOption || !ignoreUnrecognizedOption) { 41 | super.processOption(arg, iter); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/reason/InferredSubObjectPropertyAxiomGeneratorIncludingIndirect.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.reason; 2 | 3 | import java.util.Set; 4 | import javax.annotation.Nonnull; 5 | import org.semanticweb.owlapi.model.OWLDataFactory; 6 | import org.semanticweb.owlapi.model.OWLObjectProperty; 7 | import org.semanticweb.owlapi.model.OWLObjectPropertyExpression; 8 | import org.semanticweb.owlapi.model.OWLSubObjectPropertyOfAxiom; 9 | import org.semanticweb.owlapi.reasoner.OWLReasoner; 10 | import org.semanticweb.owlapi.util.InferredObjectPropertyAxiomGenerator; 11 | 12 | /** 13 | * An InferredAxiomGenerator which returns both direct and indirect inferred subobjectproperty 14 | * axioms. 15 | */ 16 | public class InferredSubObjectPropertyAxiomGeneratorIncludingIndirect 17 | extends InferredObjectPropertyAxiomGenerator { 18 | 19 | @Override 20 | protected void addAxioms( 21 | @Nonnull OWLObjectProperty entity, 22 | @Nonnull OWLReasoner reasoner, 23 | @Nonnull OWLDataFactory dataFactory, 24 | @Nonnull Set result, 25 | @Nonnull Set nonSimpleProperties) { 26 | for (OWLObjectPropertyExpression prop : 27 | reasoner.getSuperObjectProperties(entity, false).getFlattened()) { 28 | result.add(dataFactory.getOWLSubObjectPropertyOfAxiom(entity, prop)); 29 | } 30 | } 31 | 32 | @Override 33 | public String getLabel() { 34 | return "Sub object properties including indirect"; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /robot-core/src/test/java/org/obolibrary/robot/CURIEShortFormProviderTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import java.io.IOException; 4 | import org.junit.Test; 5 | import org.obolibrary.robot.providers.CURIEShortFormProvider; 6 | import org.semanticweb.owlapi.apibinding.OWLManager; 7 | import org.semanticweb.owlapi.model.IRI; 8 | import org.semanticweb.owlapi.model.OWLClass; 9 | import org.semanticweb.owlapi.model.OWLDataFactory; 10 | 11 | public class CURIEShortFormProviderTest extends CoreTest { 12 | 13 | @Test 14 | public void testProvider() throws IOException { 15 | IOHelper ioHelper = new IOHelper(); 16 | CURIEShortFormProvider sfp = new CURIEShortFormProvider(ioHelper.getPrefixes()); 17 | OWLDataFactory df = OWLManager.getOWLDataFactory(); 18 | 19 | // Short form 1 should return GO (longer than OBO namespace) 20 | OWLClass c1 = df.getOWLClass(IRI.create("http://purl.obolibrary.org/obo/GO_123")); 21 | String sf1 = sfp.getShortForm(c1); 22 | assert sf1.equals("GO:123"); 23 | 24 | // Short form 2 will default to base OBO since UNKNOWN is not registered 25 | OWLClass c2 = df.getOWLClass(IRI.create("http://purl.obolibrary.org/obo/UNKNOWN_123")); 26 | String sf2 = sfp.getShortForm(c2); 27 | assert sf2.equals("obo:UNKNOWN_123"); 28 | 29 | // The example NS is not in prefixes so full IRI will be returned 30 | OWLClass c3 = df.getOWLClass(IRI.create("http://example.com/UNKNOWN_456")); 31 | String sf3 = sfp.getShortForm(c3); 32 | assert sf3.equals("http://example.com/UNKNOWN_456"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, The authors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of robot nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /docs/examples/classes-properties.csv: -------------------------------------------------------------------------------- 1 | ID,LABEL,Type,SubClass Of,SubProperty Of 2 | BFO:0000050,part of,Object property,, 3 | GO:0005575,cellular_component,Class,, 4 | GO:0005622,intracellular,Class,cell part, 5 | GO:0005623,cell,Class,cellular_component, 6 | GO:0005634,nucleus,Class,intracellular membrane-bounded organelle, 7 | GO:0031974,membrane-enclosed lumen,Class,cellular_component, 8 | GO:0031981,nuclear lumen,Class,'part of' some nucleus|intracellular organelle lumen|nuclear part, 9 | GO:0043226,organelle,Class,cellular_component, 10 | GO:0043227,membrane-bounded organelle,Class,organelle, 11 | GO:0043229,intracellular organelle,Class,'part of' some intracellular|intracellular part|organelle, 12 | GO:0043231,intracellular membrane-bounded organelle,Class,intracellular organelle|membrane-bounded organelle, 13 | GO:0043233,organelle lumen,Class,'part of' some organelle|membrane-enclosed lumen|organelle part, 14 | GO:0044422,organelle part,Class,'part of' some organelle|cellular_component, 15 | GO:0044424,intracellular part,Class,'part of' some intracellular|cell part, 16 | GO:0044428,nuclear part,Class,'part of' some nucleus|intracellular organelle part, 17 | GO:0044446,intracellular organelle part,Class,'part of' some 'intracellular organelle'|'part of' some intracellular|'part of' some organelle|intracellular part|organelle part, 18 | GO:0044464,cell part,Class,'part of' some cell|cellular_component, 19 | GO:0070013,intracellular organelle lumen,Class,'part of' some 'intracellular organelle'|intracellular organelle part|organelle lumen, 20 | rdfs:label,,Annotation property,, 21 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | environment { 4 | TARGET_ADMIN_EMAILS = 'james@overton.ca' 5 | } 6 | 7 | stages { 8 | stage('Build') { 9 | steps { 10 | sh 'mvn clean package verify' 11 | } 12 | } 13 | 14 | stage('Test') { 15 | steps { 16 | script { 17 | if (env.BRANCH_NAME == 'master') { 18 | try { 19 | sh 'git clone https://github.com/obi-ontology/obi.git' 20 | sh 'mkdir -p obi/build' 21 | sh 'cp bin/robot.jar obi/build/robot.jar' 22 | sh 'cd obi && make test' 23 | } finally { 24 | sh 'rm -rf obi' 25 | } 26 | } else { 27 | sh 'java -jar bin/robot.jar help' 28 | } 29 | } 30 | } 31 | } 32 | } 33 | 34 | post { 35 | always { 36 | archiveArtifacts artifacts: 'bin/*.jar', fingerprint: true 37 | } 38 | failure { 39 | echo "There has been a failure in the ${env.BRANCH_NAME} pipeline." 40 | mail bcc: '', body: "There has been a pipeline failure in ${env.BRANCH_NAME}. Please see: https://build.obolibrary.io/job/ontodev/job/robot/job/${env.BRANCH_NAME}", cc: '', from: '', replyTo: '', subject: "ROBOT Integration Test FAIL", to: "${TARGET_ADMIN_EMAILS}" 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/pH-extract.ttl: -------------------------------------------------------------------------------- 1 | @prefix : . 2 | @prefix owl: . 3 | @prefix rdf: . 4 | @prefix xml: . 5 | @prefix xsd: . 6 | @prefix rdfs: . 7 | @base . 8 | 9 | rdf:type owl:Ontology . 10 | 11 | ################################################################# 12 | # Annotation properties 13 | ################################################################# 14 | 15 | ### http://www.w3.org/2000/01/rdf-schema#comment 16 | rdfs:comment rdf:type owl:AnnotationProperty . 17 | 18 | 19 | ### http://www.w3.org/2000/01/rdf-schema#label 20 | rdfs:label rdf:type owl:AnnotationProperty . 21 | 22 | 23 | ################################################################# 24 | # Classes 25 | ################################################################# 26 | 27 | ### http://purl.obolibrary.org/obo/UO_0000196 28 | rdf:type owl:Class ; 29 | rdfs:comment "\"A dimensionless concentration notation which denotes the acidity of a solution in terms of activity of hydrogen ions (H+).\" [Wikipedia:Wikipedia]"^^xsd:string ; 30 | rdfs:label "pH"^^xsd:string . 31 | 32 | 33 | ### Generated by the OWL API (version 4.5.6) https://github.com/owlcs/owlapi 34 | -------------------------------------------------------------------------------- /docs/examples/nucleus-iris.csv: -------------------------------------------------------------------------------- 1 | rdfs:label,SubClass Of [ID],SubClass Of [IRI] 2 | cell,GO:0005575,http://purl.obolibrary.org/obo/GO_0005575 3 | cell part,GO:0005575,http://purl.obolibrary.org/obo/GO_0005575 4 | cellular_component,, 5 | intracellular,GO:0044464,http://purl.obolibrary.org/obo/GO_0044464 6 | intracellular membrane-bounded organelle,GO:0043227|GO:0043229,http://purl.obolibrary.org/obo/GO_0043227|http://purl.obolibrary.org/obo/GO_0043229 7 | intracellular organelle,GO:0043226|GO:0044424,http://purl.obolibrary.org/obo/GO_0043226|http://purl.obolibrary.org/obo/GO_0044424 8 | intracellular organelle lumen,GO:0043233|GO:0044446,http://purl.obolibrary.org/obo/GO_0043233|http://purl.obolibrary.org/obo/GO_0044446 9 | intracellular organelle part,GO:0044422|GO:0044424,http://purl.obolibrary.org/obo/GO_0044422|http://purl.obolibrary.org/obo/GO_0044424 10 | intracellular part,GO:0044464,http://purl.obolibrary.org/obo/GO_0044464 11 | membrane-bounded organelle,GO:0043226,http://purl.obolibrary.org/obo/GO_0043226 12 | membrane-enclosed lumen,GO:0005575,http://purl.obolibrary.org/obo/GO_0005575 13 | nuclear lumen,GO:0044428|GO:0070013,http://purl.obolibrary.org/obo/GO_0044428|http://purl.obolibrary.org/obo/GO_0070013 14 | nuclear part,GO:0044446,http://purl.obolibrary.org/obo/GO_0044446 15 | nucleus,GO:0043231,http://purl.obolibrary.org/obo/GO_0043231 16 | organelle,GO:0005575,http://purl.obolibrary.org/obo/GO_0005575 17 | organelle lumen,GO:0031974|GO:0044422,http://purl.obolibrary.org/obo/GO_0031974|http://purl.obolibrary.org/obo/GO_0044422 18 | organelle part,GO:0005575,http://purl.obolibrary.org/obo/GO_0005575 19 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/exceptions/RowParseException.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot.exceptions; 2 | 3 | /** Template row cannot be parsed. */ 4 | public class RowParseException extends Exception { 5 | private static final long serialVersionUID = -646778731149993824L; 6 | 7 | public int rowNum = -1; 8 | public int colNum = -1; 9 | public String ruleID; 10 | public String ruleName; 11 | public String cellValue; 12 | 13 | /** 14 | * Throw new RowParseException with message. 15 | * 16 | * @param s message 17 | */ 18 | public RowParseException(String s) { 19 | super(s); 20 | } 21 | 22 | /** 23 | * Throw new RowParseException with message amd cause. 24 | * 25 | * @param s message 26 | * @param e cause 27 | */ 28 | public RowParseException(String s, Exception e) { 29 | super(s, e); 30 | } 31 | 32 | /** 33 | * Throw a new RowParseException with message and location. 34 | * 35 | * @param s message 36 | * @param rowNum row number 37 | * @param colNum column number 38 | * @param cellValue value of cell with exception 39 | */ 40 | public RowParseException(String s, int rowNum, int colNum, String cellValue) { 41 | super(s); 42 | this.rowNum = rowNum; 43 | this.colNum = colNum; 44 | this.cellValue = cellValue; 45 | 46 | try { 47 | this.ruleName = s.substring(s.indexOf("#") + 1, s.indexOf("ERROR") + 5).trim().toLowerCase(); 48 | } catch (Exception e) { 49 | this.ruleName = ""; 50 | } 51 | 52 | this.ruleID = "ROBOT-template:" + this.ruleName.replace(" ", "-"); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /docs/report_queries/missing_definition.md: -------------------------------------------------------------------------------- 1 | # Missing Definition 2 | 3 | **Problem:** An entity does not have a definition or elucidation. This may cause confusion or misuse of the entity. Excludes deprecated entities. 4 | 5 | **OBO Foundry Principle:** [6 - Textual Definitions](http://obofoundry.org/principles/fp-006-textual-definitions.html) 6 | 7 | **Solution:** Add a definition. 8 | 9 | ```sparql 10 | PREFIX obo: 11 | PREFIX owl: 12 | PREFIX rdfs: 13 | PREFIX rdf: 14 | PREFIX oboInOwl: 15 | 16 | SELECT DISTINCT ?entity ?property ?value WHERE { 17 | VALUES ?property { obo:IAO_0000115 } 18 | ?entity ?any ?o 19 | FILTER NOT EXISTS { ?entity ?property ?value } 20 | FILTER NOT EXISTS { ?entity obo:IAO_0000600 ?elucidation } 21 | FILTER NOT EXISTS { ?entity a owl:Ontology } 22 | FILTER NOT EXISTS { ?entity a owl:NamedIndividual } 23 | FILTER NOT EXISTS { ?entity owl:deprecated true } 24 | FILTER NOT EXISTS { 25 | ?entity rdfs:subPropertyOf oboInOwl:SubsetProperty . 26 | } 27 | FILTER EXISTS { 28 | ?entity ?prop2 ?object . 29 | FILTER (?prop2 != rdf:type) 30 | FILTER (?prop2 != owl:equivalentClass) 31 | FILTER (?prop2 != owl:disjointWith) 32 | FILTER (?prop2 != owl:equivalentProperty) 33 | FILTER (?prop2 != owl:sameAs) 34 | FILTER (?prop2 != owl:differentFrom) 35 | FILTER (?prop2 != owl:inverseOf) 36 | } 37 | FILTER (!isBlank(?entity)) } 38 | ORDER BY ?entity 39 | ``` 40 | -------------------------------------------------------------------------------- /robot-command/src/main/java/org/obolibrary/robot/Command.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import org.apache.commons.cli.Options; 4 | 5 | /** 6 | * A simple interface for all ROBOT commands. 7 | * 8 | * @author James A. Overton 9 | */ 10 | public interface Command { 11 | 12 | String global = "global#"; 13 | String missingFileError = global + "MISSING FILE ERROR file '%s' for '%s' does not exist"; 14 | 15 | /** 16 | * Name of the command. 17 | * 18 | * @return name 19 | */ 20 | String getName(); 21 | 22 | /** 23 | * Brief description of the command. 24 | * 25 | * @return description 26 | */ 27 | String getDescription(); 28 | 29 | /** 30 | * Command-line usage for the command. 31 | * 32 | * @return usage 33 | */ 34 | String getUsage(); 35 | 36 | /** 37 | * Command-line options for the command. 38 | * 39 | * @return options 40 | */ 41 | Options getOptions(); 42 | 43 | /** 44 | * All commands can be call from the Java command line with an array of strings as arguments. 45 | * 46 | * @param args strings to use as arguments 47 | */ 48 | void main(String[] args); 49 | 50 | /** 51 | * All commands offer an execute method that can be chained from previous commands. 52 | * 53 | * @param inputState the input from the previous command, or null 54 | * @param args the command-line arguments 55 | * @return the updated state, or a new state, or null 56 | * @throws Exception on any problem 57 | */ 58 | CommandState execute(CommandState inputState, String[] args) throws Exception; 59 | } 60 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/missing_definition.rq: -------------------------------------------------------------------------------- 1 | # # Missing Definition 2 | # 3 | # **Problem:** An entity does not have a definition or elucidation. This may cause confusion or misuse of the entity. Excludes deprecated entities. 4 | # 5 | # **OBO Foundry Principle:** [6 - Textual Definitions](http://obofoundry.org/principles/fp-006-textual-definitions.html) 6 | # 7 | # **Solution:** Add a definition. 8 | 9 | PREFIX obo: 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | PREFIX rdf: 13 | PREFIX oboInOwl: 14 | 15 | SELECT DISTINCT ?entity ?property ?value WHERE { 16 | VALUES ?property { obo:IAO_0000115 } 17 | ?entity ?any ?o 18 | FILTER NOT EXISTS { ?entity ?property ?value } 19 | FILTER NOT EXISTS { ?entity obo:IAO_0000600 ?elucidation } 20 | FILTER NOT EXISTS { ?entity a owl:Ontology } 21 | FILTER NOT EXISTS { ?entity a owl:NamedIndividual } 22 | FILTER NOT EXISTS { ?entity owl:deprecated true } 23 | FILTER NOT EXISTS { 24 | ?entity rdfs:subPropertyOf oboInOwl:SubsetProperty . 25 | } 26 | FILTER EXISTS { 27 | ?entity ?prop2 ?object . 28 | FILTER (?prop2 != rdf:type) 29 | FILTER (?prop2 != owl:equivalentClass) 30 | FILTER (?prop2 != owl:disjointWith) 31 | FILTER (?prop2 != owl:equivalentProperty) 32 | FILTER (?prop2 != owl:sameAs) 33 | FILTER (?prop2 != owl:differentFrom) 34 | FILTER (?prop2 != owl:inverseOf) 35 | } 36 | FILTER (!isBlank(?entity)) } 37 | ORDER BY ?entity 38 | -------------------------------------------------------------------------------- /robot-core/src/main/java/org/obolibrary/robot/PythonOperation.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | import py4j.GatewayServer; 6 | 7 | /** 8 | * Starts a gateway server for Py4J to execute ROBOT operations via Python. This class can be used 9 | * to start the JVM directly from python using Py4J's `launch_gateway`. 10 | * 11 | * @author Becky Jackson 12 | */ 13 | public class PythonOperation { 14 | 15 | /** Logger. */ 16 | private static final Logger logger = LoggerFactory.getLogger(PythonOperation.class); 17 | 18 | /** 19 | * Run a Gateway Server. 20 | * 21 | * @param args strings to use as arguments 22 | */ 23 | public void main(String[] args) { 24 | GatewayServer gs = null; 25 | try { 26 | gs = run(null); 27 | } finally { 28 | if (gs != null) { 29 | gs.shutdown(); 30 | } 31 | } 32 | } 33 | 34 | /** 35 | * Run a Gateway Server. 36 | * 37 | * @param port port to run JVM on, or null 38 | * @return a GatewayServer to connect to 39 | */ 40 | public static GatewayServer run(Integer port) { 41 | GatewayServer gs; 42 | if (port != null) { 43 | gs = new GatewayServer(null, port); 44 | } else { 45 | gs = new GatewayServer(null); 46 | } 47 | gs.start(); 48 | port = gs.getPort(); 49 | System.out.println( 50 | String.format("ROBOT JVM listening for Py4j on port %d, press Ctrl-C to exit", port)); 51 | logger.debug(String.format("ROBOT JVM started on port %d", port)); 52 | return gs; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /docs/report_queries/deprecated_property_reference.md: -------------------------------------------------------------------------------- 1 | # Deprecated Property Reference 2 | 3 | **Problem:** A deprecated property is used in a logical axiom. A deprecated property can be the child of another property (e.g., ObsoleteProperty), but it cannot have children or be used in blank nodes or equivalence statements. Additionally, a deprecated property should not have any equivalent properties. 4 | 5 | **Solution:** Replace deprecated property. 6 | 7 | ```sparql 8 | PREFIX obo: 9 | PREFIX oboInOwl: 10 | PREFIX owl: 11 | PREFIX rdfs: 12 | PREFIX rdf: 13 | 14 | SELECT DISTINCT ?entity ?property ?value WHERE { 15 | { 16 | VALUES ?property { 17 | owl:equivalentProperty 18 | rdfs:subPropertyOf 19 | owl:inverseOf 20 | } 21 | ?entity a owl:ObjectProperty ; 22 | owl:deprecated true . 23 | ?value1 ?property ?entity . 24 | } 25 | UNION 26 | { 27 | VALUES ?property { 28 | owl:equivalentProperty 29 | rdfs:subPropertyOf 30 | } 31 | ?entity a owl:DatatypeProperty ; 32 | owl:deprecated true . 33 | ?value1 ?property ?entity . 34 | } 35 | UNION 36 | { 37 | ?property owl:deprecated true . 38 | ?entity ?property ?value1 . 39 | } 40 | UNION 41 | { 42 | ?property owl:deprecated true . 43 | ?entity ?x ?value1 . 44 | ?value1 a owl:Restriction ; 45 | owl:onProperty ?property . 46 | } 47 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 48 | } 49 | ORDER BY ?entity 50 | ``` 51 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/report_queries/deprecated_property_reference.rq: -------------------------------------------------------------------------------- 1 | # # Deprecated Property Reference 2 | # 3 | # **Problem:** A deprecated property is used in a logical axiom. A deprecated property can be the child of another property (e.g., ObsoleteProperty), but it cannot have children or be used in blank nodes or equivalence statements. Additionally, a deprecated property should not have any equivalent properties. 4 | # 5 | # **Solution:** Replace deprecated property. 6 | 7 | PREFIX obo: 8 | PREFIX oboInOwl: 9 | PREFIX owl: 10 | PREFIX rdfs: 11 | PREFIX rdf: 12 | 13 | SELECT DISTINCT ?entity ?property ?value WHERE { 14 | { 15 | VALUES ?property { 16 | owl:equivalentProperty 17 | rdfs:subPropertyOf 18 | owl:inverseOf 19 | } 20 | ?entity a owl:ObjectProperty ; 21 | owl:deprecated true . 22 | ?value1 ?property ?entity . 23 | } 24 | UNION 25 | { 26 | VALUES ?property { 27 | owl:equivalentProperty 28 | rdfs:subPropertyOf 29 | } 30 | ?entity a owl:DatatypeProperty ; 31 | owl:deprecated true . 32 | ?value1 ?property ?entity . 33 | } 34 | UNION 35 | { 36 | ?property owl:deprecated true . 37 | ?entity ?property ?value1 . 38 | } 39 | UNION 40 | { 41 | ?property owl:deprecated true . 42 | ?entity ?x ?value1 . 43 | ?value1 a owl:Restriction ; 44 | owl:onProperty ?property . 45 | } 46 | BIND (if(isIRI(?value1), ?value1, "blank node" ) as ?value) 47 | } 48 | ORDER BY ?entity 49 | -------------------------------------------------------------------------------- /robot-core/src/test/java/org/obolibrary/robot/RepairOperationTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import java.io.IOException; 4 | import java.util.Collections; 5 | import org.junit.Test; 6 | import org.semanticweb.owlapi.apibinding.OWLManager; 7 | import org.semanticweb.owlapi.model.IRI; 8 | import org.semanticweb.owlapi.model.OWLAnnotationProperty; 9 | import org.semanticweb.owlapi.model.OWLOntology; 10 | import org.semanticweb.owlapi.model.OWLOntologyCreationException; 11 | 12 | /** Tests for MergeOperation. */ 13 | public class RepairOperationTest extends CoreTest { 14 | 15 | /** 16 | * Test repair an ontology 17 | * 18 | * @throws IOException on file problem 19 | * @throws OWLOntologyCreationException on ontology problem 20 | */ 21 | @Test 22 | public void testRepair() throws IOException, OWLOntologyCreationException { 23 | OWLOntology ontology = loadOntology("/need-of-repair.owl"); 24 | IOHelper iohelper = new IOHelper(); 25 | RepairOperation.repair(ontology, iohelper, true); 26 | iohelper.saveOntology(ontology, "target/foo.owl"); 27 | assertIdentical("/repaired.owl", ontology); 28 | } 29 | 30 | @Test 31 | public void testXrefRepair() throws IOException { 32 | OWLAnnotationProperty hasDbXref = 33 | OWLManager.getOWLDataFactory() 34 | .getOWLAnnotationProperty( 35 | IRI.create("http://www.geneontology.org/formats/oboInOwl#hasDbXref")); 36 | OWLOntology ontology = loadOntology("/xref-need-of-repair.obo"); 37 | IOHelper iohelper = new IOHelper(); 38 | RepairOperation.repair(ontology, iohelper, true, Collections.singleton(hasDbXref)); 39 | assertIdentical("/xref-repaired.obo", ontology); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /docs/examples/errors.csv: -------------------------------------------------------------------------------- 1 | table,cell,rule,message 2 | immune_exposures,D7,is-required,"Cell is empty but rule: ""is-required true"" does not allow this." 3 | immune_exposures,F8,is-required,"Cell is empty but rule: ""is-required true"" does not allow this." 4 | immune_exposures,B9,equivalent-to,"Validation failed for rule: ""Dengue virus equivalent-to (NCBITaxon:11060)""." 5 | immune_exposures,C9,equivalent-to,"Validation failed for rule: ""NCBITaxon:11060 equivalent-to 'Dengue virus'""." 6 | immune_exposures,D10,subclass-of,"Validation failed for rule: ""Dengue virus 2 subclass-of disease""." 7 | immune_exposures,D10,subclass-of,"Validation failed for rule: ""Dengue virus 2 subclass-of 'has material basis in' some 'Dengue virus'""." 8 | immune_exposures,B11,equivalent-to,"Validation failed for rule: ""blood or 'Hepacivirus C' equivalent-to (UBERON:0000178)""." 9 | immune_exposures,C11,equivalent-to,"Validation failed for rule: ""UBERON:0000178 equivalent-to (blood or 'Hepacivirus C')""." 10 | immune_exposures,F11,is-excluded,"Cell is non-empty (""Chronic"") but rule: ""is-excluded true"" does not allow this." 11 | immune_exposures,D12,equivalent-to,"Validation failed for rule: ""wheat allergy equivalent-to (DOID:12206)""." 12 | immune_exposures,D12,equivalent-to,"Validation failed for rule: ""dengue hemorrhagic fever equivalent-to (DOID:3660)""." 13 | immune_exposures,D12,subclass-of,"Validation failed for rule: ""wheat allergy subclass-of 'has material basis in' some 'Dengue virus'""." 14 | immune_exposures,E12,equivalent-to,"Validation failed for rule: ""DOID:3660 equivalent-to 'dengue hemorrhagic fever'""." 15 | immune_exposures,E12,equivalent-to,"Validation failed for rule: ""DOID:12206 equivalent-to 'wheat allergy'""." 16 | -------------------------------------------------------------------------------- /docs/repair.md: -------------------------------------------------------------------------------- 1 | # Repair 2 | 3 | ROBOT can repair certain problems encountered in ontologies. So far, this is limited to updating axioms pointing to deprecated classes with their replacement class (indicated using [term replaced by](http://purl.obolibrary.org/obo/IAO_0100001)). 4 | 5 | This situation can arise in a number of different ways: 6 | 7 | 1. When you are editing an ontology in Protege, you obsolete a class, but forget to repair axioms that reference this. 8 | 2. When you rebuild an import module using [extract](extract), and the upstream ontology has obsoleted classes that you are using. 9 | 10 | For more on obsoletion workflows, see the [obsoletion guide](https://ontology-development-kit.readthedocs.io/en/latest/ObsoleteTerm.html) in the Ontology Development Kit documentation. 11 | 12 | To repair an ontology (with the name `need-of-repair.owl`) run the following command: 13 | 14 | robot repair \ 15 | --input need-of-repair.owl \ 16 | --output results/repaired.owl 17 | 18 | This will generate a new file `results/repaired.owl`. You can compare this with the original file (either using unix `diff` or [robot diff](diff)). If the changes that were made look good then you can simply replace the source file with the repaired file (`mv results/repaired.owl need-of-repair.owl`). 19 | 20 | By default, annotation axioms are not migrated to replacement classes. However, this can be enabled for a list of annotation properties passed either as arguments to `--annotation-property` or in a term file `--annotation-properties-file`: 21 | 22 | robot repair \ 23 | --input xref-need-of-repair.obo \ 24 | --annotation-property oboInOwl:hasDbXref \ 25 | --output results/xref-repaired.obo 26 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | ## ROBOT Documentation Makefile 2 | # 3 | # This file helps us keep our documentation up-to-date 4 | # by generating Markdown files form various source files. 5 | # The goal is DRY: Don't Repeat Yourself! 6 | 7 | 8 | ### Jekyll 9 | # 10 | # You can test the documentation locall using Jekyll and various GitHub Pages stuff: 11 | # https://help.github.com/articles/setting-up-your-github-pages-site-locally-with-jekyll/ 12 | 13 | 14 | ### Configuration 15 | 16 | # Collect the list of query files for report. 17 | REPORT_QUERIES := $(wildcard ../robot-core/src/main/resources/report_queries/*.rq) 18 | REPORT_DOCS := $(foreach x, $(REPORT_QUERIES), report_queries/$(notdir $(basename $(x))).md) 19 | 20 | 21 | ### Main Tasks 22 | 23 | all: $(REPORT_DOCS) report_queries/index.md 24 | 25 | 26 | ### Report Tasks 27 | 28 | report_queries: 29 | mkdir -p $@ 30 | 31 | # Convert each SPARQL file to a Markdown file. 32 | report_queries/%.md: ../robot-core/src/main/resources/report_queries/%.rq | report_queries 33 | awk '/^PREFIX/ && !x {print "```sparql"; x=1} 1' $< \ 34 | | sed 's/^# \? \?//' \ 35 | > $@ 36 | echo '```' >> $@ 37 | 38 | # Use the master profile to generate a page of links. 39 | report_queries/index.md: ../robot-core/src/main/resources/report_profile.txt | report_queries 40 | echo '# Report Queries' > $@ 41 | echo '' >> $@ 42 | echo 'The table below lists all the queries run by the `report` command,' >> $@ 43 | echo 'with their default severity levels.' >> $@ 44 | echo 'See [`report`](../report) for more details.' >> $@ 45 | echo '' >> $@ 46 | echo '| Name | Default Severity' >> $@ 47 | echo '|-------|-------------------' >> $@ 48 | awk -F' ' '{x=$$2; gsub(/_/," ",$$2); print "| [" $$2 "](" x ") | " $$1}' $< \ 49 | >> $@ 50 | -------------------------------------------------------------------------------- /robot-command/src/test/java/org/obolibrary/robot/CommandLineHelperTest.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import static org.junit.Assert.assertEquals; 4 | import static org.junit.Assert.assertThrows; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | import org.junit.Test; 9 | 10 | /** Tests for CommandLineHelper. */ 11 | public class CommandLineHelperTest { 12 | 13 | /** 14 | * Test command line splitting. 15 | * 16 | * @throws Exception on parsing problem 17 | */ 18 | @Test 19 | public void testParseArgs() throws Exception { 20 | String arg = ""; 21 | List args = new ArrayList(); 22 | assertEquals("Empty arg list", CommandLineHelper.parseArgList(arg), args); 23 | 24 | arg = "command"; 25 | args.clear(); 26 | args.add("command"); 27 | assertEquals("Just a command", CommandLineHelper.parseArgList(arg), args); 28 | 29 | arg = "command -i --foo PARAM 'single quoted' \"double quoted\""; 30 | args.clear(); 31 | args.add("command"); 32 | args.add("-i"); 33 | args.add("--foo"); 34 | args.add("PARAM"); 35 | args.add("single quoted"); 36 | args.add("double quoted"); 37 | assertEquals("Basic command", CommandLineHelper.parseArgList(arg), args); 38 | 39 | arg = "command 'nested \"quotes\" with \\\" escapes and\nnewlines'"; 40 | args.clear(); 41 | args.add("command"); 42 | args.add("nested \"quotes\" with \\\" escapes and\nnewlines"); 43 | assertEquals("Nested quotations", CommandLineHelper.parseArgList(arg), args); 44 | 45 | // Expect an Exception here 46 | assertThrows( 47 | Exception.class, 48 | () -> { 49 | CommandLineHelper.parseArgList("unbalanced 'quotes"); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /robot-core/src/main/resources/validate-template.jinja2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 14 | 23 | 24 | Validation report 25 | 26 | 27 | 28 |

Validation report

29 | 30 | {{ table }} 31 | 32 | 36 | 40 | 44 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docs/examples/no-tautologies.owl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | A 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | B 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | C 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /robot-maven-plugin/README.md: -------------------------------------------------------------------------------- 1 | # ROBOT Maven Plugins 2 | 3 | This directory contains additional `mvn` plugins specific to ROBOT. 4 | 5 | Before using these plugins, you must install the JAR: 6 | ``` 7 | mvn install 8 | ``` 9 | 10 | ## ROBOT Plugins 11 | 12 | ### Update Context 13 | 14 | This plugin updates the [`obo_context.jsonld`](https://raw.githubusercontent.com/ontodev/robot/master/robot-core/src/main/resources/obo_context.jsonld) file with the most current prefixes from the [OBO Foundry context file](https://raw.githubusercontent.com/OBOFoundry/OBOFoundry.github.io/master/registry/obo_context.jsonld). You must be connected to the internet to run this plugin. 15 | 16 | This can be run from either this directory, or the root `robot` directory: 17 | ``` 18 | mvn robot:UpdateContext -N 19 | ``` 20 | 21 | The `-N` flag is recommended so that the plugin does not run multiple times for each child module. 22 | 23 | --- 24 | 25 | ## Creating New Plugins 26 | 27 | Add new plugins `src/main/java/org.obolibrary.robot` directory following this filename convention: `{plugin-name}Mojo.java`. 28 | 29 | These new Java classes must extend the `AbstractMojo` class and have an `execute()` method. A `@Mojo` annotation is also required to specify the name of the plugin. 30 | ``` 31 | @Mojo(name = "MyNewPlugin") 32 | public class MyNewPluginMojo extends AbstractMojo { 33 | 34 | public void execute() { 35 | // Do stuff 36 | } 37 | } 38 | ``` 39 | 40 | For more information on plugin development, [see here](https://maven.apache.org/guides/plugin/guide-java-plugin-development.html). 41 | 42 | Then, install the new JAR for this module: 43 | ``` 44 | mvn install 45 | ``` 46 | 47 | Now you can run your plugin from the command line anywhere within this repo: 48 | ``` 49 | mvn robot:MyNewPlugin -N 50 | ``` 51 | 52 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple.owl: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 14 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | test one 29 | Test 1 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /robot-command/src/main/java/org/obolibrary/robot/CommandState.java: -------------------------------------------------------------------------------- 1 | package org.obolibrary.robot; 2 | 3 | import org.semanticweb.owlapi.model.OWLOntology; 4 | 5 | /** 6 | * A simple state container for communicating between Commands. 7 | * 8 | * @author James A. Overton 9 | */ 10 | public class CommandState { 11 | /** An ontology to pass between commands. */ 12 | private OWLOntology ontology = null; 13 | 14 | /** The path to the ontology. */ 15 | private String ontologyPath = null; 16 | 17 | /** The path to the catalog. */ 18 | private String catalogPath = null; 19 | 20 | /** 21 | * Get the catalog path. 22 | * 23 | * @return the catalog path 24 | */ 25 | public String getCatalogPath() { 26 | return catalogPath; 27 | } 28 | 29 | /** 30 | * Get the ontology (not a copy). 31 | * 32 | * @return the ontology 33 | */ 34 | public OWLOntology getOntology() { 35 | return ontology; 36 | } 37 | 38 | /** 39 | * Get the ontology path. 40 | * 41 | * @return the ontology path 42 | */ 43 | public String getOntologyPath() { 44 | return ontologyPath; 45 | } 46 | 47 | /** 48 | * Set the catalog path. 49 | * 50 | * @param catalogPath the catalog to use 51 | */ 52 | public void setCatalogPath(String catalogPath) { 53 | this.catalogPath = catalogPath; 54 | } 55 | 56 | /** 57 | * Set the ontology. 58 | * 59 | * @param ontology the ontology to store 60 | */ 61 | public void setOntology(OWLOntology ontology) { 62 | this.ontology = ontology; 63 | } 64 | 65 | /** 66 | * Set the ontology path. 67 | * 68 | * @param ontologyPath the path to the ontology 69 | */ 70 | public void setOntologyPath(String ontologyPath) { 71 | this.ontologyPath = ontologyPath; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /robot-core/src/test/resources/simple_update.owl: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | Test 1 28 | test one 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | test 2 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | --------------------------------------------------------------------------------