Code Monkey home page Code Monkey logo

ontology-visualization's Introduction

Ontology Visualization

Example

./ontology_viz.py -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

In order to use this tool, you’ll need to make sure you have rdflib installed.

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

ontology-visualization's People

Contributors

fatestigma avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.