Skip to main content

No project description provided

Project description

Ontoviz

image

image

Documentation Status

Code style: black

Ontology visualization with Python

Installation

python -m pip install ontoviz

Example

    ontoviz_to_dot -o test.dot test.ttl -O ontology.ttl
    dot -Tpng -o test.png test.dot
  • Use -o to indicate the path of output file
  • Use -O to indicate the input ontology (Optional).
  • Use -C to indicate the configuration file (Optional).
    • max_label_length: config the max length of labels. If the text exceeds the length, exceeded part will be replaced with "…". Default value is 0.

    • blacklist: config the predicate that you don't want to see in the graph.

    • class_inference_in_object: config the predicate that can inference the object is a Class, even if the class doesn't defined in the ontology.

    • label_property: config the predicate that used for labeling nodes, if such a label exists, it will display inside the node.

    • tooltip_property: config the predicate that contains the tooltip texts.

    • bnode_regex: a list of regexes, if an uri matches, then it will be dispaly as a blank node without its uri nor label. It can be useful if you have a lot of reifications.

    • colors: config the colors of nodes

      • class, literal, instance can accept HEX value(e.g. "#ff0000" ), MATLAB style(e.g. "r" ), and color name (e.g. "red" ).

        "colors": { "class": "#ff0000", "literal": "r", "instance": "red", }

      • instance can also accept a dict value to specify the color of each class instance. And use "default" to to set color for undefined instances.

        "instance": { "https://tac.nist.gov/tracks/SM-KBP/2018/ontologies/SeedlingOntology#Facility": "#a6cee3", "default": "#ffff99" }

      • filled: config whether fill the node, default value: true.

  • Classes defined in the ontology will be omitted in the output graph. This action can be switched with argument -V.

Useful Graphviz flags

  • -K to specify which layout algorithm to use. E.g. -Kneato and -Ksfdp . Notice that inorder to use sfdp layout algorithm, you will need to build your graphviz with GTS.
  • -T to specify the output format.
  • -G to set a graph attribute. E.g. -Goverlap=prism

Requirements

All the minimal Python requirements are installed during

python -m pip install ontoviz

For a development setup do

git clone https://github.com/WWU-AMM/ontoviz
cd ontoviz
virtualenv venv
. venv/bin/activate
python -m pip install -e .[full]
pre-commit install

This will also install tools for documentation building and testing

In order to convert dot into png or svg image, you will need Graphviz.

Testing

Simply run pytest from the repository root. All tests are also run automatically by github actions on push/PR.

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

ontoviz-0.post1.dev1.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

ontoviz-0.post1.dev1-py2.py3-none-any.whl (15.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ontoviz-0.post1.dev1.tar.gz.

File metadata

  • Download URL: ontoviz-0.post1.dev1.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for ontoviz-0.post1.dev1.tar.gz
Algorithm Hash digest
SHA256 a58de384ef0e03673b011e71270b6723c053bc1f269a5d19986812d7a02a3b67
MD5 653854ba872557618d662e7e6c060e88
BLAKE2b-256 29333fae326c161d34fde2fff91fe2e0c38106b0d65edee21f8b2f9e04592bda

See more details on using hashes here.

Provenance

File details

Details for the file ontoviz-0.post1.dev1-py2.py3-none-any.whl.

File metadata

  • Download URL: ontoviz-0.post1.dev1-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for ontoviz-0.post1.dev1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bba6a21e36a98bc3ffbd0e6107397130238750e120b8b6dd7d47b5e41bab74c1
MD5 0a4f737c5a18700422a95f73a6aac536
BLAKE2b-256 2d6eaa35096585c11f95043aafb4b5c77d5fd138cd3606dc9220fca75cf66ab8

See more details on using hashes here.

Provenance

Supported by

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