Skip to main content

An extension for gavel introducing OWL translations.

Project description

An extension for Gavel introducing OWL and FOWL (OWL with FOL annotations) translations as well as related functionality regarding OWL and FOWL ontologies.

Installation

The latest released version can be installed with:

pip install gavel-owl

The latest development version can be installed with:

pip install git+https://github.com/gavel-tool/python-gavel-owl.git@dev

For the development version, you need to install the jar-file manually. This is done by running mvn install in the java directory. Copy the resulting jar-file from java/target/java-1.0-SNAPSHOT.one-jar.jar to src/gavel_owl/jars/api.jar (be sure to use the one-jar-file, not the regular jar-file).

Usage

This plugin extends gavel by two new dialects, owl and fowl. This enables the various features of gavel to be used with owl / fowl ontologies. These functionalities use the java-based OWL-API. Therefore, you have to start the java backend in order to use most owl-based functionalities. The gavel-owl plugin provides a single command to do that:

python -m gavel start-server

After the server has been started successfully, you can translate an existing owl ontology to first-order logic in tptp syntax using:

python -m gavel translate owl tptp your-ontology.owl

You can also submit arguments to fist-order prover Vampire consisting of the translation of a given owl ontology as premises and conjectures formulated in tptp using:

python -m gavel owl-prove your-premises.owl your-conjectures.tptp

In order to translate an owl ontology with first-order annotations into tptp syntax, you can use:

python -m gavel translate fowl tptp your-ontology.owl

The running java backend can be terminated:

python -m gavel stop-server

There are several commands available that can be accessed via:

python -m gavel COMMAND [ARGUMENTS]
  • start-server: starts a subprocess that connects the Python program to its Java components. Other functions such as translate will only run if this connection has been established beforehand. The optional arguments -jp and -pp can be used for custom ports. Otherwise, the default ports will be used. -jp and -pp can be used for all other commands (except prove) analogously.

  • translate: A Gavel function that translates the contents of a given file from one language, e.g. OWL, to another language, e.g. TPTP. If the option –save is used, the translation is stored in the given file, else it is gets displayed in the command line. The following options are avaiable for translate:

    • --clif-properties (only for input dialect fowl) This option accepts arbitrary many IRIs or labels of OWL annotation properties. The values of annotation axioms using these properties will be interpreted as CLIF axioms. If this option is set with no arguments, the tool will not look for any CLIF axioms. If this option is not set, it will default to https://github.com/gavel-tool/python-gavel-owl/clif_annotation as an annotation property.

    • --tptp-properties (only for input dialect fowl) This is analogous to clif-properties. Here, the default value is https://github.com/gavel-tool/python-gavel-owl/tptp_annotation.

    • --shorten-names -n If this flag is set, the short form of IRIs will be used.

    • --readable-names (only for input dialects fowl and owl) This flag replaces IRIs with labels (if available) or shortened IRIs.

    • --no-annotations -a This flag can be set to avoid rendering annotations in the output dialect. For the translation from fowl to tptp, these annotations contain the OWL axiom or FOL annotation the is the origin of the corresponding FOL axioms.

    • --jp (only for input dialects fowl and owl) Sets the Java port for the connection to FOWL’s Java server. This should be the same number used for start-server. The default value is 25333.

    • --pp (only for input dialects fowl and owl) Sets the Python port for the connection to FOWL’s Java server. This should be the same number used for start-server. The default value is 25334.

    • --verbose -v (only for input dialect fowl) If this flag is set, additional information on the translation process will be put in the command line, such as the mapping between OWL entities and FOL names.

    • --save -s This option specifies the path for saving the translation result. If save is not set, the result will be put out to the command line.

    • --save-dol (only for input dialect fowl) This argument can be used to set a path under which to store the DOL-file generated from the annotated ontology.

    • --tptp-input (only for input dialect fowl) Use this argument in combination with one or multiple filenames to add TPTP files to the ontology. The axioms in these files are treated like TPTP annotations.

    • --clif-input (only for input dialect `` fowl``) Similar to --tptp-input, but for CLIF files. CLIF annotations are ignored. Advanced features such as imports or modules are not supported.

  • check-consistency: uses the OWL reasoner Hermit to determine whether a given ontology is consistent or not.

  • owl-prove: takes two arguments, an OWL file and a TPTP file. It uses Vampire to prove the conjectures provided in the TPTP file based on the translation of the OWL file. If the –steps flag is set, it will return the proof steps, otherwise it will only return the reasoner’s result.

  • stop-server: Ends the Java connection established by start-server.

  • prove: a function from Gavel that takes the name of a FOL prover and a TPTP file and returns the prover’s result for the given problem.

  • prove-ontology-entailment: Checks if an OWL ontology can be entailed from another. It returns the result based on OWL reasoning and based on FOL reasoning using the fowl translation.

For further options use:

python -m gavel [COMMAND] --help

Development

To run all the tests run:

tox

Note, to combine the coverage data from all the tox environments run:

Windows

set PYTEST_ADDOPTS=--cov-append
tox

Other

PYTEST_ADDOPTS=--cov-append tox

Changelog

0.0.0 (2020-11-23)

  • First release on PyPI.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gavel_owl-0.2.0.tar.gz (39.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gavel_owl-0.2.0-py2.py3-none-any.whl (31.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gavel_owl-0.2.0.tar.gz.

File metadata

  • Download URL: gavel_owl-0.2.0.tar.gz
  • Upload date:
  • Size: 39.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gavel_owl-0.2.0.tar.gz
Algorithm Hash digest
SHA256 bfe2fa24efe8e538aed997fdf4954d41cce21e59a7ae8ffca77ae23f90dc2bce
MD5 cedef1b309d34abc17884e5bbf75f4e9
BLAKE2b-256 63ecf28bc4267ddd05281a675b39a52e4a8e75afc6b1f34f79b1ede29bfe79a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gavel_owl-0.2.0.tar.gz:

Publisher: python-publish.yml on gavel-tool/python-gavel-owl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gavel_owl-0.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: gavel_owl-0.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 31.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gavel_owl-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a80dddf0a40ea0966306f81b59f766a6b0b5d1dc9c004fcc24fbfdaa9442242d
MD5 b356c348607bc422b23432c0ee93d3a0
BLAKE2b-256 6772faa6ffc991843a5313bd75bf46bc3e3658f2a18968bfe022fc65bd4b8994

See more details on using hashes here.

Provenance

The following attestation bundles were made for gavel_owl-0.2.0-py2.py3-none-any.whl:

Publisher: python-publish.yml on gavel-tool/python-gavel-owl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page