Usage
Although the package is called owl-cli, the command you invoke is called owl .
|
You can call the built-in overview of commands and arguments via --help
:
Usage:
Usage: owl [-v] [--help] [--version] [COMMAND]
Description:
Command line tool for ontology engineering
Options:
--help Show short help
-v, --verbose Specify multiple -v options to increase verbosity,
e.g. use `-v`, `-vv` or `-vvv` for more details
--version Show current version
Commands:
...
Other than the general help, you give one argument, the command, which will take its own arguments, for example:
owl diagram --format png
Commands that take ontology files as an input support all formats that are supported by OWL API, notably RDF/Turtle, RDF/XML, OWL/XML and OWL Functional Syntax.
diagram
Command
The diagram
command takes an OWL ontology as input and generates an
automatically layouted diagram for it in the SVG or PNG format. This is
implemented by mapping the ontology’s axioms into a graph description in the
Graphviz language, which is passed to its dot
layouting engine. Attributes such as fonts can be customized using arguments.
As no standardized graphical notation for OWL exists, the diagram notation used here is described in detail on a separate page: Diagram Notation. |
General Usage
General usage: owl diagram [options] input [output]
, where input
can be
either an ontology file or -
(which means: read from standard in) and output
can be either an ontology file or -
(which means: write to standard out). If
output
is not given, the output filename is the input filename with its file
extension changed, e.g. myontology.ttl → myontology.svg. If input
is -
and
output
is not given, the output is set to standard out.
Options
Option | Description | Default | Notes |
---|---|---|---|
|
Diagram layout direction |
left_to_right |
Possible values: [top_to_bottom, left_to_right] |
|
Path to |
dot |
By default, |
|
Default font |
Verdana |
|
|
Default font size |
12 |
|
|
Output file format |
svg |
Possible values: [png, svg] |
|
Font for nodes |
Verdana |
|
|
Font size for nodes |
Verdana |
|
|
The margin to render inside of nodes |
0.05,0.0 |
See the Graphviz documentation for more information |
|
Node shape |
box |
See the Graphviz documentation for more information |
|
Node style |
rounded |
See the Graphviz documentation for more information |
|
Color for boxes, fonts and edges |
white |
See the Graphviz documentation for more information |
|
Background color for the generated diagram |
white |
See the Graphviz documentation for more information |
Example Usage
Simple invocation with default arguments:
# Will create myontology.svg
owl diagram myontology.ttl
Invocation where the output is specified as standard out and piped to convert to create a different format:
owl diagram myontology.ttl - | convert - myontology.jpg
Invocation where an ontology is downloaded, some terms are filtered and then piped to owl diagram:
curl http://www.ontologydesignpatterns.org/cp/owl/partof.owl | \
grep -v 'comment|cpannotation|versionInfo' | owl diagram - partof.svg
write
Command
General Usage
The write
command takes any RDF file in
RDF/Turtle,
RDF/XML,
RDF N-Triples or
N3 format as input and writes it out in any of those formats.
When writing RDF/Turtle, the formatting of the resulting output can be configured extensively, as
this makes use of the turtle-formatter library.
General usage: owl write [options] input [output]
, where input
can be either an RDF file, a URL
(starting with http
or https
) or -
(which means: read from standard in) and output
can be
either an RDF file or -
(which means: write to standard out). If
output
is not given, the output filename is the input filename with its file
extension changed, e.g. myontology.nt → myontology.ttl. If input
is -
or a URL and
output
is not given, the output is set to standard out.
Options
Option | Description | Default | Notes |
---|---|---|---|
|
Output file format |
turtle |
Possible values: [turtle, rdfxml, ntriple, n3] |
|
Input file format |
turtle |
Possible values: [turtle, rdfxml, ntriple, n3] |
|
Prefix with corresponding URI to add as |
This can be given multiple times, for multiple prefixes. You can specify a well-known prefix
(currently: rdf, rdfs, xsd, owl, dcterms), e.g. |
|
|
Alignment of |
off |
Possible values: [left, off, right] |
|
Output encoding |
utf_8 |
Possible values: [latin1, utf_16_be, utf_16_le, utf_8, utf_8_bom] |
|
Defines how double numbers are formatted |
|
See here for more information on the format |
|
End of line style |
lf |
Possible values: [cr, crlf, lf] |
|
Indent style |
space |
Possible values: [tab, space]. Note that when choosing |
|
Write first predicate in new line of block |
Switched off by default |
|
|
Write |
Switched off by default |
|
|
Use commas for multiple objects |
Switched off by default |
|
|
Use no commas for multiple objects for this predicate |
This can be given multiple times. |
|
|
Use long form for literals, e.g. |
Switched off by default |
|
|
Align objects for same predicates |
Switched off by default |
|
|
Align predicates for same subjects |
Switched off by default |
|
|
Indentation size after forced line wraps |
4 |
|
|
Do not insert newline at end of file |
Switched off by default |
|
|
Indentation size in spaces |
2 |
|
|
Keeps prefixes that are not part of any statement |
Switched off by default |
|
|
Sort order for prefixes (if they appear in a model) |
[rdf, rdfs, xsd, owl] |
Add this switch multiple times, once for each prefix, in the desired order |
|
Sort order for subjects by type (if they appear in a model) |
[ |
Add this switch multiple times, once for each subject type, in the desired order |
|
Sort order for predicates (if they appear on a subject) |
[ |
Add this switch multiple times, once for each predicate, in the desired order |
|
Sort order for objects |
[ |
Add this switch multiple times, once for each object type, in the desired order |
|
Name pattern for blank node IDs |
|
A |
Example Usage
Simple invocation with default arguments:
# Read myontology.ttl and print it in formatted Turtle format
owl write myontology.ttl
# Read myontology.owl in RDF/XML format and print it in formatted Turtle format, writing output.ttl
owl write -i rdfxml myontology.owl output.ttl
# Read myontology.n3 in N3 format and print it in formatted Turtle format to stdout
owl write -i n3 myontology.n3
# Read myontology.nt in N-Triples format and print it in RDF/XML format to stdout
owl write -i ntriple -o rdfxml myontology.nt
Read an N-Triples file and write formatted Turtle, while also configuring which prefixes should be used:
owl write -prdf -powl -pxsd -p'ex=http://example.com#' -i ntriple myontology.nt
Read a Turtle file and print it out, while configuring the output’s formatting and prefix order:
owl write --indentSize 4 --writeRdfType --prefixOrder owl --prefixOrder rdf myontology.turtle
Read a remote ontology in RDF/XML format and print it in formatted Turtle format:
owl write -i rdfxml 'http://www.ontologydesignpatterns.org/cp/owl/partof.owl'