Class Builder - Command Line Interface

Java class generator from OWL ontologies

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

io.github.radkovo
ArtifactId

ArtifactId

class-builder-cli
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Class Builder - Command Line Interface
Java class generator from OWL ontologies

Download class-builder-cli

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.radkovo/class-builder-cli/ -->
<dependency>
    <groupId>io.github.radkovo</groupId>
    <artifactId>class-builder-cli</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.radkovo/class-builder-cli/
implementation 'io.github.radkovo:class-builder-cli:1.0'
// https://jarcasting.com/artifacts/io.github.radkovo/class-builder-cli/
implementation ("io.github.radkovo:class-builder-cli:1.0")
'io.github.radkovo:class-builder-cli:jar:1.0'
<dependency org="io.github.radkovo" name="class-builder-cli" rev="1.0">
  <artifact name="class-builder-cli" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.radkovo', module='class-builder-cli', version='1.0')
)
libraryDependencies += "io.github.radkovo" % "class-builder-cli" % "1.0"
[io.github.radkovo/class-builder-cli "1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
io.github.radkovo : class-builder-core jar 1.0
commons-cli : commons-cli jar 20040117.000000
org.slf4j : slf4j-api jar 1.7.25
ch.qos.logback : logback-classic jar 1.1.2

test (1)

Group / Artifact Type Version
junit : junit jar 3.8.1

Project Modules

There are no modules declared in this project.

RDF4J Class Builder

(c) 2017-2019 Radek Burget ([email protected])

RDF4J Class Builder is a tool for generating Java classes from OWL ontology definitions. For every class defined in the OWL file, it generates a Java class definition, that contains

  • Property definitions, getters and setters for every OWL property that has the given class in owl:domain. The property cardinality is distinguished using the owl:Property, owl:FunctionalProperty and owl:InverseFunctionalProperty definitions.
  • The addToModel() and loadFromModel() methods that allow loading and storing the class instatnces from and to a RDF graph represented by the RDF4J Model class.

Additionaly, a factory interface is generated for the whole ontology that allows implementing custom factories for creating the object instances.

The project is inspired by and integrates with the the RDF4J Vocabulary Builder project.

Installation

RDF4J Class Builder is distributed as platform-independent runnable jar archive:

  • Download the runnable archive ClassBuilder.jar from Releases
  • Run the following command in the command prompt (depending on your operating system):
    java -jar ClassBuilder.jar

You should see a list of available parametres.

Usage

RDF4J Class Builder takes an OWL definition file in any format (RDF/XML, Turtle, ...) as the input. It generates two separate components:

  • A single vocabulary class (using the built-in RDF4J Vocabulary Builder). The vocabulary class defines the URI constants for all the classes and predicates defined in the OWL source.
  • Individual java class definitions (as described above) for all the classes defined in the OWL source.

For both the vocabulary and the class definitions, their java package and the target folder may be specified via the command line as follows:

ClassBuilder [options...] <input-file>
  <input-file>                  the input file to read from
  -f,--format <format>          mime-type of the input file (will try to guess
                                if absent)
  -v,--vocab-name <class-name>  vocabulary class name
  -o,--vocab-dir <path>         the output directory for the vocabulary (current
                                directory when absent)
  -O,--class-dir <path>         the output directory for the classes (vocabulary
                                directory when absent)
  -p,--vocab-package <package>  vocabulary package declaration (will use default
                                (empty) package if absent)
  -P,--class-package <package>  class package declaration (will use the
                                vocabulary package if absent)

Example usage:

java -jar ClassBuilder.jar \
	info.owl \
	-v INFO \
	-o src/com/example/vocabulary \
	-p com.example.vocabulary \
	-O src/com/example/ontology \
	-P com.example.ontology \

Building

RDF4J Class Builder may be build from the sources by maven. After cloning the source repository, use mvn package for building and packaging all the components.

Acknowledgements

This work was supported by the Ministry of the Interior of the Czech Republic as a part of the project Integrated platform for analysis of digital data from security incidents VI20172020062.

Versions

Version
1.0