./ontology_viz.py -o test.dot test.ttl -O ontology.ttl
dot -Tpng -o test.png test.dot- Use
-oto indicate the path of output file - Use
-Oto indicate the input ontology (Optional). - Use
-Cto 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 is0.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 aClass, 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 nodesclass,literal,instancecan accept HEX value(e.g."#ff0000"), MATLAB style(e.g."r"), and color name (e.g."red").
"colors": { "class": "#ff0000", "literal": "r", "instance": "red", }
instancecan 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.
-Kto specify which layout algorithm to use. E.g.-Kneatoand-Ksfdp. Notice that inorder to usesfdplayout algorithm, you will need to build your graphviz with GTS.-Tto specify the output format.-Gto set a graph attribute. E.g.-Goverlap=prism
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.