Skip to content

Commit

Permalink
Merge pull request #964 from ontodev/expand-command
Browse files Browse the repository at this point in the history
Implementation of expand command.
  • Loading branch information
jamesaoverton authored Jun 16, 2022
2 parents 2cdc556 + 8b41799 commit 4b8ffae
Show file tree
Hide file tree
Showing 9 changed files with 788 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added
- Add new command: [`expand`] [#964]

### Fixed
- Fix OBOGraphs by updating `guava` [#1009]

Expand Down Expand Up @@ -316,6 +319,7 @@ First official release of ROBOT!
[#978]: https://github.com/ontodev/robot/pull/978
[#973]: https://github.com/ontodev/robot/pull/973
[#971]: https://github.com/ontodev/robot/pull/971
[#964]: https://github.com/ontodev/robot/pull/964
[#960]: https://github.com/ontodev/robot/pull/960
[#955]: https://github.com/ontodev/robot/pull/955
[#953]: https://github.com/ontodev/robot/pull/953
Expand Down
151 changes: 151 additions & 0 deletions docs/examples/expanded-annotated.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
@prefix : <http://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/> .

<http://example.org/> rdf:type owl:Ontology .

#################################################################
# Annotation properties
#################################################################

### http://example.org/never_part_of
:never_part_of rdf:type owl:AnnotationProperty ;
<http://purl.obolibrary.org/obo/OMO_0002000> """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
CONSTRUCT {
?a a owl:Class .
?b a owl:Class .
?a owl:disjointWith [
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?b
]
}
WHERE {
?a :never_part_of ?b .
}""" .


### http://example.org/part_disjoint_with
:part_disjoint_with rdf:type owl:AnnotationProperty ;
<http://purl.obolibrary.org/obo/OMO_0002000> """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
CONSTRUCT {
?a a owl:Class .
?b a owl:Class .
[
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?a ;
owl:disjointWith [
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?b
]
]
}
WHERE {
?a :part_disjoint_with ?b .
}""" .


### http://purl.obolibrary.org/obo/OMO_0002000
<http://purl.obolibrary.org/obo/OMO_0002000> rdf:type owl:AnnotationProperty ;
rdfs:label "defined by construct" .


### http://purl.org/dc/terms/source
<http://purl.org/dc/terms/source> rdf:type owl:AnnotationProperty .


#################################################################
# Object Properties
#################################################################

### http://example.org/part_of
:part_of rdf:type owl:ObjectProperty .


#################################################################
# Classes
#################################################################

### http://example.org/A
:A rdf:type owl:Class ;
:part_disjoint_with :B .

[ rdf:type owl:Axiom ;
owl:annotatedSource :A ;
owl:annotatedProperty rdf:type ;
owl:annotatedTarget owl:Class ;
<http://purl.org/dc/terms/source> :never_part_of
] .

[ rdf:type owl:Axiom ;
owl:annotatedSource :A ;
owl:annotatedProperty rdf:type ;
owl:annotatedTarget owl:Class ;
<http://purl.org/dc/terms/source> :part_disjoint_with
] .


### http://example.org/B
:B rdf:type owl:Class ;
owl:disjointWith [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :A
] ;
:never_part_of :A .

[ rdf:type owl:Axiom ;
owl:annotatedSource :B ;
owl:annotatedProperty rdf:type ;
owl:annotatedTarget owl:Class ;
<http://purl.org/dc/terms/source> :never_part_of
] .

[ rdf:type owl:Axiom ;
owl:annotatedSource :B ;
owl:annotatedProperty rdf:type ;
owl:annotatedTarget owl:Class ;
<http://purl.org/dc/terms/source> :part_disjoint_with
] .

[ rdf:type owl:Axiom ;
owl:annotatedSource :B ;
owl:annotatedProperty owl:disjointWith ;
owl:annotatedTarget [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :A
] ;
<http://purl.org/dc/terms/source> :never_part_of
] .


#################################################################
# General axioms
#################################################################

[ rdf:type owl:Axiom ;
owl:annotatedSource [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :A ;
owl:disjointWith [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :B
]
] ;
owl:annotatedProperty owl:disjointWith ;
owl:annotatedTarget [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :B
] ;
<http://purl.org/dc/terms/source> :part_disjoint_with
] .


### Generated by the OWL API (version 4.5.6) https://github.com/owlcs/owlapi
87 changes: 87 additions & 0 deletions docs/examples/expanded-terms.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
@prefix : <http://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/> .

<http://example.org/> rdf:type owl:Ontology .

#################################################################
# Annotation properties
#################################################################

### http://example.org/never_part_of
:never_part_of rdf:type owl:AnnotationProperty ;
<http://purl.obolibrary.org/obo/OMO_0002000> """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
CONSTRUCT {
?a a owl:Class .
?b a owl:Class .
?a owl:disjointWith [
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?b
]
}
WHERE {
?a :never_part_of ?b .
}""" .


### http://example.org/part_disjoint_with
:part_disjoint_with rdf:type owl:AnnotationProperty ;
<http://purl.obolibrary.org/obo/OMO_0002000> """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
CONSTRUCT {
?a a owl:Class .
?b a owl:Class .
[
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?a ;
owl:disjointWith [
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?b
]
]
}
WHERE {
?a :part_disjoint_with ?b .
}""" .


### http://purl.obolibrary.org/obo/OMO_0002000
<http://purl.obolibrary.org/obo/OMO_0002000> rdf:type owl:AnnotationProperty ;
rdfs:label "defined by construct" .


#################################################################
# Object Properties
#################################################################

### http://example.org/part_of
:part_of rdf:type owl:ObjectProperty .


#################################################################
# Classes
#################################################################

### http://example.org/A
:A rdf:type owl:Class ;
:part_disjoint_with :B .


### http://example.org/B
:B rdf:type owl:Class ;
owl:disjointWith [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :A
] ;
:never_part_of :A .


### Generated by the OWL API (version 4.5.6) https://github.com/owlcs/owlapi
101 changes: 101 additions & 0 deletions docs/examples/expanded.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
@prefix : <http://example.org/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://example.org/> .

<http://example.org/> rdf:type owl:Ontology .

#################################################################
# Annotation properties
#################################################################

### http://example.org/never_part_of
:never_part_of rdf:type owl:AnnotationProperty ;
<http://purl.obolibrary.org/obo/OMO_0002000> """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
CONSTRUCT {
?a a owl:Class .
?b a owl:Class .
?a owl:disjointWith [
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?b
]
}
WHERE {
?a :never_part_of ?b .
}""" .


### http://example.org/part_disjoint_with
:part_disjoint_with rdf:type owl:AnnotationProperty ;
<http://purl.obolibrary.org/obo/OMO_0002000> """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX : <http://example.org/>
CONSTRUCT {
?a a owl:Class .
?b a owl:Class .
[
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?a ;
owl:disjointWith [
a owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom ?b
]
]
}
WHERE {
?a :part_disjoint_with ?b .
}""" .


### http://purl.obolibrary.org/obo/OMO_0002000
<http://purl.obolibrary.org/obo/OMO_0002000> rdf:type owl:AnnotationProperty ;
rdfs:label "defined by construct" .


#################################################################
# Object Properties
#################################################################

### http://example.org/part_of
:part_of rdf:type owl:ObjectProperty .


#################################################################
# Classes
#################################################################

### http://example.org/A
:A rdf:type owl:Class ;
:part_disjoint_with :B .


### http://example.org/B
:B rdf:type owl:Class ;
owl:disjointWith [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :A
] ;
:never_part_of :A .


#################################################################
# General axioms
#################################################################

[ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :A ;
owl:disjointWith [ rdf:type owl:Restriction ;
owl:onProperty :part_of ;
owl:someValuesFrom :B
]
] .


### Generated by the OWL API (version 4.5.6) https://github.com/owlcs/owlapi
Loading

0 comments on commit 4b8ffae

Please sign in to comment.