Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if __name__ == '__main__':
TEST_ONLINE = False
try:
if TEST_ONLINE:
from ..core.ontospy import Ontospy
g = Ontospy("http://cohere.open.ac.uk/ontology/cohere.owl#")
else:
uri, g = get_random_ontology(50) # pattern="core"
v = KompleteViz(g, title="", theme=random_theme())
v.build()
v.preview()
sys.exit(0)
except KeyboardInterrupt as e: # Ctrl-C
raise e
def __init__(self, ontospy_graph, title="", theme=""):
"""
Init
"""
super(KompleteViz, self).__init__(ontospy_graph, title)
self.static_files = [
"custom",
"libs/bootswatch3_2",
"libs/bootstrap-3_3_7-dist",
"libs/jquery/1_12_4/",
"libs/chartjs-2_4_0"
]
self.theme = validate_theme(theme)
:param g:
:param viz_index:
:param main_entity:
:return:
"""
this_viz = VISUALIZATIONS_LIST[viz_index]
if this_viz['ID'] == "html-simple":
from .viz_html_single import HTMLVisualizer
v = HTMLVisualizer(g, title)
elif this_viz['ID'] == "html-complex":
from .viz_html_multi import KompleteViz
v = KompleteViz(g, title, theme)
elif this_viz['ID'] == "markdown":
from .viz_markdown import MarkdownViz
v = MarkdownViz(g, title)
else:
return False
url = v.build(path)
return url
"main_entity_type": "concept",
"theme": self.theme,
"ontograph": self.ontospy_graph
}
extra_context.update(self.highlight_code(entity))
contents = self._renderTemplate("html-multi/browser/browser_conceptinfo.html", extraContext=extra_context)
FILE_NAME = entity.slug + ".html"
self._save2File(contents, FILE_NAME, browser_output_path)
return main_url
class KompleteVizMultiModel(KompleteViz):
"""
Specialized version that supports customizing where the static url / folder are.
The idea is to pass a location which can be shared by multiple html outputs. (eg multiple html-complex ontology folders)
eg
python -m ontospy.viz.scripts.export_all -o ~/Desktop/test2/ --theme random
"""
def __init__(self, ontospy_graph, title="", theme="", static_url="", output_path_static=""):
"""
Init
"""
super(KompleteVizMultiModel, self).__init__(ontospy_graph, title, theme)