Skip to content

Commit 97ced24

Browse files
committed
Add more documentation.
Prepare a Maven-built site with some more detailled documentation for each command. Remove most of that documentation from the top-level README. Also fix some Javadoc comments.
1 parent b8600f3 commit 97ced24

File tree

9 files changed

+546
-213
lines changed

9 files changed

+546
-213
lines changed

README.md

Lines changed: 7 additions & 210 deletions
Original file line numberDiff line numberDiff line change
@@ -7,217 +7,14 @@ Kit](https://github.com/INCATools/ontology-development-kit) (ODK). It
77
provides additional ROBOT commands to perform tasks not covered by the
88
ROBOT built-in command set.
99

10-
Provided commands
11-
-----------------
12-
13-
### validate
14-
This command is intended to check the alignment of the ontology against
15-
another, “upper-level” ontology. The ontology is considered “aligned” if
16-
all its classes are subclasses of at least one class of the upper
17-
ontology.
18-
19-
The upper ontology to check against is specified using either the
20-
`--upper-ontology` option (to load it from a local file) or the
21-
`--upper-ontology-iri` option (to load it from a resolvable IRI). If
22-
neither option is used, the command defaults to check against the [Core
23-
Ontology for Biology and Biomedicine](https://github.com/OBOFoundry/COB)
24-
(COB).
25-
26-
By default, the command will _fail_ (interrupting any pipeline it is a
27-
part of in the process) if the ontology is not aligned. Use the
28-
`--fail false` option to allow the pipeline to continue without
29-
erroring out.
30-
31-
The command will produce a report listing the top-level unaligned
32-
classes (if any) if the `--report-output <FILE>` option is used.
33-
34-
To only check the alignment of classes in a given namespace, use the
35-
`--base-iri <namespace>` option – that option may be used repeatedly to
36-
check classes in different namespaces.
37-
38-
If the `--ignore-dangling true` option is used, classes that are
39-
considered “dangling” will be ignored. You may want to use that option
40-
if you are not restricting the alignment check to your ontology’s
41-
namespace, to avoid failing the check for any single dangling class
42-
that is merely referenced from your ontology. On the other hand, not
43-
using that option could be a way to check that your ontology does _not_
44-
reference dangling classes (which could indicate that you are missing
45-
some imports).
46-
47-
### normalize
48-
This command is intended to perform various “normalisation” operations.
49-
50-
The main normalisation operation is the injection of
51-
_SubAnnotationPropertyOf_ axioms for annotation properties that
52-
represent subsets (`--subset-decls true`) or synonym types
53-
(`--synonym-decls true`).
54-
55-
For subsets, if the ontology contains any annotation using the
56-
`oboInOwl:inSubset` property (which marks a class as belonging to a
57-
subset), and the annotation value is an IRI, this will inject an axiom
58-
declaring that the IRI represents a subproperty of
59-
`oboInOwl:SubsetProperty`.
60-
61-
For synonyms, if the ontology contains any annotation using the
62-
`oboInOwl:hasSynonymType` property (used on synonyn annotations to
63-
indicate the nature of the synonym, e.g. abbreviations, etc.), and the
64-
annotation value is an IRI, this will inject an axiom declaring that the
65-
IRI represents a subproperty of `oboInOwl:SynonymTypeProperty`.
66-
67-
In both cases, the normalisation will only consider IRIs that fall under
68-
the following namespaces:
69-
70-
* `http://purl.obolibrary.org/obo/`;
71-
* `http://www.ebi.ac.uk/efo/`;
72-
* `http://w3id.org/biolink/`.
73-
74-
Additional namespaces can be specified using the `--base-iri` option.
75-
76-
Another normalisation operation is the merging of duplicate axioms that
77-
differ only by their annotations. This is done with the
78-
`--merge-axioms true` option. Of note, the existence of that option is
79-
a (hopefully) temporary workaround until the corresponding feature in
80-
ROBOT (`robot repair --merge-axiom-annotations true`) is fixed, as it
81-
currently does not work as expected.
82-
83-
Lastly, the command can also inject a `dc:source` annotation on the
84-
ontology, set from the version IRI (`--add-source true`). This is used
85-
in the ODK to annotate import modules with the version IRI of the
86-
ontology they are derived from. (It is hoped that this could soon be
87-
replaced by a built-in feature in ROBOT’s `annotate` command.)
88-
89-
### subset
90-
The `subset` command creates an ontology subset. It is intended to
91-
replace several equivalent OWLTools commands with a uniformed behaviour.
92-
93-
#### Subset definition
94-
The command offers several ways of defining which classes should be
95-
included in the subset:
96-
97-
* With a DL query, e.g `--query "'part of' some 'nervous system'"`
98-
99-
The subset will include all equivalent classes and subclasses matching
100-
the query (to include superclasses as well, add the `--ancestors true`
101-
option). The query can use either quoted labels (as in the example
102-
above) or short-form identifiers (e.g. `--query UBERON:0001016`).
103-
When using quoted labels, if the query consists of a single class, be
104-
mindful that you will most likely need to quote it _twice_, as in
105-
`--query "'nervous system'"` – the outer quotes will be stripped by
106-
your command interpreter.
107-
108-
Be also mindful that not all reasoners allow querying using a class
109-
expression – ELK, which the `subset` command uses by default, does not,
110-
so you might want to use WHELK instead (`--reasoner WHELK`).
111-
112-
* With a subset name or IRI, e.g. `--subset PFX:MY_SUBSET`
113-
114-
This will select all classes that are marked with a `oboInOwl:inSubset`
115-
annotation whose value is the `PFX:MY_SUBSET` IRI. If the argument is
116-
not an IRI (e.g. `--subset MY_SUBSET`), this will select all classes
117-
with a `oboInOwl:inSubset` annotation whose value ends with `#MY_SUBSET`
118-
regardless of the namespace – this is for compatibility with OWLTools.
119-
120-
* With an explicit list of terms (`--term TERM` or `--term-file FILE`)
121-
122-
Any class whose ID is explicitly specified on the command line with
123-
`--term CLASS:ID` or is listed in the file pointed to by the argument
124-
to `--term-file` (which is expected to contain a list of IDs, with one
125-
ID per line, excluding blank lines and lines starting with `#`) will be
126-
included in the subset.
127-
128-
The `--query`, `--subset`, `--term`, and `--term-file` option can be
129-
mixed freely and used repeatedly. Their effects are cumulative. For
130-
example:
131-
132-
```sh
133-
odk:subset --reasoner WHELK \
134-
--query "'nervous system'" \
135-
--query "'part of' some 'nervous system'" \
136-
--term UBERON:0000955
137-
```
138-
139-
will create a subset from (1) 'nervous system' and all its descendants
140-
and equivalents, (2) all classes that are 'part of' the 'nervous
141-
system', and (3) the UBERON:0000955 class.
142-
143-
#### Expanding the subset
144-
By default, the subset generated by the `subset` command contains _only_
145-
the classes defined using any of the methods shown in the previous
146-
section, plus all the object and annotation properties used by those
147-
classes.
148-
149-
Use the `--fill-gaps true` option to expand the subset so that it
150-
contains all the classes that are referenced from within the initial
151-
subset.
152-
153-
Several options allow to control how the subset is expanded.
154-
155-
* `--follow-property PROPERTY`
156-
157-
By default, the expanded subset will include all classes referenced by
158-
_any_ class expression used within the initial subset. If the
159-
`--follow-property PROPERTY` option is used (where `PROPERTY` is the
160-
IRI of an object property), only class expressions that use the
161-
indicated object property will be considered. The option may be used
162-
several times to follow several object properties.
163-
164-
* `--follow-in NAMESPACE`
165-
166-
When this option is used, only classes that are in the indicated
167-
namespace will be included in the expanded subset (the option may be
168-
used several times to include classes from several namespaces). Axioms
169-
that refer to a class outside of the followed namespace(s) will be
170-
excluded from the subset.
171-
172-
* `--not-follow-in NAMESPACE`
173-
174-
This is the opposite of the previous option. It prevents the inclusion
175-
of any classes that is in the indicated namespace. It may also be used
176-
repeatedly to exclude classes from several namespaces. Axioms that refer
177-
to a class within the not-followed namespace(s) will be excluded from
178-
the subset.
179-
180-
The `--follow-in` and `--not-follow-in` options are mutually
181-
exclusive. If both are used in the same `subset` command, the
182-
`--follow-in` options take precedence and any `--not-follow-in` option
183-
will be ignored.
184-
185-
* `--no-dangling false`
186-
187-
By default, “dangling” classes are not considered for inclusion when
188-
expanding the subset, even if they are referenced from within the
189-
subset. Use that option to include them anyway.
190-
191-
Note that none of the 4 options above affect the _initial subset_ (the
192-
subset defined by any of the `--query`, `--subset`, `--term`, or
193-
`--term-file` options). They only affect how the subset is expanded. For
194-
example, if the initial subset contains a class in the `GO:` namespace,
195-
that class will be present in the final subset even if the
196-
`--not-follow-in http://purl.obolibrary.org/obo/GO_` option is used. To
197-
force the exclusion of _any_ GO class, either make sure that the initial
198-
subset does not list any such class, or forcibly remove all GO classes
199-
from the ontology (e.g. with `robot remove` or `robot filter`) before
200-
creating the subset.
201-
202-
#### Writing the subset
203-
By default, once the subset is created, it becomes the main ontology
204-
that is being manipulated by the ROBOT pipeline (replacing the initial
205-
ontology). This means that:
206-
207-
* it can be saved to file using the traditional `--output` option;
208-
* it will be passed down to any further ROBOT command.
209-
210-
If you use the `--write-to FILE` option, the subset will be saved into
211-
the indicated file, and will _not_ be passed down to the rest of the
212-
ROBOT pipeline (the unmodified, initial ontology will be passed down
213-
instead). This allows creating several subsets from the same ontology:
214-
215-
```sh
216-
robot merge -i my-ontology.owl \
217-
odk:subset --subset MY_SUBSET --write-to my-subset.owl \
218-
odk:subset --subset ANOTHER_SUBSET --write-to another-subset.owl
219-
```
10+
Available commands
11+
------------------
12+
The following commands are provided by the plugin:
22013

14+
* `odk:subset`: to create ontology subsets;
15+
* `odk:validate`: to validate an ontology against an upper-level
16+
ontology;
17+
* `odk:normalize`: to “normalise” an ontology.
22118

22219
Building
22320
--------

pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,28 @@
129129
</execution>
130130
</executions>
131131
</plugin>
132+
<plugin>
133+
<groupId>org.apache.maven.plugins</groupId>
134+
<artifactId>maven-site-plugin</artifactId>
135+
<version>3.12.1</version>
136+
</plugin>
132137
</plugins>
133138
</build>
139+
140+
<reporting>
141+
<plugins>
142+
<plugin>
143+
<artifactId>maven-project-info-reports-plugin</artifactId>
144+
<version>3.7.0</version>
145+
<reportSets>
146+
<reportSet />
147+
</reportSets>
148+
</plugin>
149+
<plugin>
150+
<groupId>org.apache.maven.plugins</groupId>
151+
<artifactId>maven-javadoc-plugin</artifactId>
152+
<version>3.10.0</version>
153+
</plugin>
154+
</plugins>
155+
</reporting>
134156
</project>

src/main/java/org/incenp/obofoundry/odk/SubsetCommand.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,17 @@
4141

4242
import com.google.common.base.Optional;
4343

44+
/**
45+
* A command to create an ontology subset.
46+
* <p>
47+
* That command is intended to replace both the
48+
* <code>--extract-ontology-subset --fill-gaps</code> and the
49+
* <code>--reasoner-query --make-ontology-from-results</code> commands of
50+
* OWLTools. As such, it supplements the <code>extract -m subset</code> command
51+
* of the standard distribution of ROBOT, which can be used to replace the
52+
* <code>--extract-ontology-subset</code> OWLTools command (note the absence of
53+
* <code>--fill-gaps</code>!).
54+
*/
4455
public class SubsetCommand extends BasePlugin {
4556

4657
private static final Logger logger = LoggerFactory.getLogger(SubsetCommand.class);

src/main/java/org/incenp/obofoundry/odk/SubsetExtractor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public void followProperty(IRI propertyIRI) {
149149
* When filling gaps, by default all referenced classes are included in the
150150
* extended subset. If this method is used, then only classes whose IRI starts
151151
* with the specified prefix will be included. This takes precedence over
152-
* “excluded prefixes” as added by the {@link #excludedPrefixes} method.
152+
* “excluded prefixes” as added by the {@link #excludePrefix(String)} method.
153153
* <p>
154154
* This method may be called several times to define several namespaces. A class
155155
* will be included if its IRI matches any of the included prefixes.
@@ -171,8 +171,8 @@ public void includePrefix(String prefix) {
171171
* <p>
172172
* If this method is used, then classes whose IRI starts with the specified
173173
* prefix will never be included when filling gaps. This method is incompatible
174-
* with the use of {@link #includedPrefixes}, which takes precedence if both
175-
* methods are used on the same instance.
174+
* with the use of {@link #includePrefix(String)}, which takes precedence if
175+
* both methods are used on the same instance.
176176
* <p>
177177
* This method may be called several times to define several namespaces. A class
178178
* will be included only if its IRI does not match any of the excluded prefixes.

src/site/markdown/index.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
ODK ROBOT Plugin
2+
================
3+
4+
This is a [ROBOT](http://robot.obolibrary.org/) plugin intended to be
5+
used within the [Ontology Development
6+
Kit](https://github.com/INCATools/ontology-development-kit) (ODK). It
7+
provides additional ROBOT commands to perform tasks not covered by the
8+
built-in command set of ROBOT.
9+
10+
Available commands
11+
------------------
12+
Currently, the ODK ROBOT plugin provides the following commands:
13+
14+
* [odk:subset](subset.html), to create ontology subsets;
15+
* [odk:validate](validate.html), to check the alignment of an ontology
16+
against an upper-level ontology;
17+
* [odk:normalize](normalize.html), to perform various normalisation
18+
operations on an ontology.
19+
20+
Using with the ODK
21+
------------------
22+
The plugin is (or will be) provided with the ODK Docker image. To use it
23+
as part of a ODK workflow, all that is needed is to make the rule in
24+
which the plugin is to be used depend on the ODK built-in rule
25+
`all_robot_plugins`. This will make the plugin available in the
26+
repository’s `src/ontology/tmp/plugins` directory, which is already set,
27+
in ODK workflows, as the ROBOT plugins directory.
28+
29+
For example:
30+
31+
```make
32+
target.owl: source1.owl source2.owl | all_robot_plugins
33+
$(ROBOT) merge -i source1.owl -i source2.owl \
34+
odk:subset --subset MY_SUBSET \
35+
--output target.owl
36+
```
37+
38+
The plugin can also be used outside of any ODK workflow, by manually
39+
instructing ROBOT to look for plugins into the `/tools/robot-plugins/`
40+
directory (e.g. by setting the `ROBOT_PLUGINS_DIRECTORY` environment
41+
variable to that directory).
42+
43+
Copying
44+
-------
45+
The ODK ROBOT plugin is distributed under the same terms as the Ontology
46+
Development Kit itself (3-clause BSD license). See the [COPYING
47+
file](https://github.com/INCATools/odk-robot-plugin/blob/main/COPYING)
48+
in the source distribution.
49+

0 commit comments

Comments
 (0)