owl-cli

(Version 1.0.0)

owl-cli is a command line tool for ontology engineering. It targets the Web Ontology Language (OWL 2) and RDF. The current main feature is the generation of automatically layed out diagrams for an OWL ontology.

You can find the source code on Github.

splash

Installation

Requirements

Things you will need to have installed to run owl-cli:

  • Java (OpenJDK) 11 or newer

  • Graphviz for the generation of diagrams. Note that this is a common package that can be installed via all popular package managers, for example apt-get, brew or rpm.

Download and install

Open your favorite terminal emulator and execute the following commands:

curl -L -o ~/.local/share/owl-cli/owl-cli.jar --create-dirs https://github.com/atextor/owl-cli/releases/download/snapshot/owl-cli.jar
echo 'function owl() { java -jar ~/.local/share/owl-cli/owl-cli.jar $*; }' >> ~/.bashrc
source ~/.bashrc

After installation, you can use the owl command: See Usage for more information.

Building from source

Building the executable JAR from source

owl-cli uses Java 15 source features, but the build generates a Java 11-compatible JAR file. This means, for building the executable JAR file, you need Java 15. The gradle build forks jobs where it expects Java 15 to be installed in a certain place (see Building the native image (executable binary) from source for an explanation). We rely on the locations as used by SDKMAN!.

Run the following commands:

# The following commands install SDKMAN!. If you have it installed already, you can skip it.
curl -sL https://get.sdkman.io | bash
echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
source $HOME/.sdkman/bin/sdkman-init.sh

# Use SDKMAN! to install JDK
sdk install java 15.0.1-open
sdk use java 15.0.1-open

# Build the project
git clone https://github.com/atextor/owl-cli.git
cd owl-cli
./gradlew

This will build cli/build/libs/owl-cli-snapshot.jar, which you then can install locally:

mkdir -p ~/.local/share/owl-cli
cp cli/build/libs/owl-cli-snapshot.jar !$/owl-cli.jar
echo 'function owl() { java -jar ~/.local/share/owl-cli/owl-cli.jar $*; }' >> ~/.bashrc
source ~/.bashrc

After that, you can use the owl command: See Usage for more information.

Building the native image (executable binary) from source

The following steps have only been tested on Linux, as of now

owl-cli uses Java 15 source features, but the build generates a Java 11-compatible JAR file, which is required for the generation of the native image using GraalVM, as GraalVM currently does not support Java 15 class files. This means, for building the native image, you need both Java 11 (i.e. GraalVM JDK) and Java 15. In particular, the gradle build must be executed using Java 11, while Java 15 is installed in a certain place where the build can find it. We rely on the locations as used by SDKMAN!.

Run the following commands:

# The following commands install SDKMAN!. If you have it installed already, you can skip it.
curl -sL https://get.sdkman.io | bash
echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config
echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config
source $HOME/.sdkman/bin/sdkman-init.sh

# Use SDKMAN! to install JDKs
sdk install java 15.0.1-open
sdk install java 20.1.0.r11-grl
sdk use java 20.1.0.r11-grl

# Build the project
git clone https://github.com/atextor/owl-cli.git
cd owl-cli
./gradlew nativeImagePass2

This will build cli/build/bin/owl, which you can put anywhere on your PATH.