Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run(graph, save_on_github=False, main_entity=None ):
"""
"""
try:
ontology = graph.ontologies[0]
uri = ontology.uri
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "d3_packHierarchy.html", "r")
t = Template(ontotemplate.read())
jsontree_classes = build_D3treeStandard(0, 99, 1, graph.toplayer)
c_total = len(graph.classes)
if len(graph.toplayer) == 1:
# the first element can be the single top level
JSON_DATA_CLASSES = json.dumps(jsontree_classes[0])
else:
# hack to make sure that we have a default top level object
JSON_DATA_CLASSES = json.dumps({'children': jsontree_classes, 'name': 'owl:Thing',})
c = Context({
"ontology": ontology,
"main_uri" : uri,
"STATIC_PATH": ONTOSPY_VIZ_STATIC,
"save_on_github" : save_on_github,
'JSON_DATA_CLASSES' : JSON_DATA_CLASSES,
ontology = graph.ontologies[0]
uri = ontology.uri
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "sigmajs.html", "r")
t = Template(ontotemplate.read())
dict_graph = build_class_json(graph.classes)
JSON_DATA_CLASSES = json.dumps(dict_graph)
if False:
c_mylist = build_D3treeStandard(0, 99, 1, graph.toplayer)
p_mylist = build_D3treeStandard(0, 99, 1, graph.toplayerProperties)
s_mylist = build_D3treeStandard(0, 99, 1, graph.toplayerSkosConcepts)
c_total = len(graph.classes)
p_total = len(graph.properties)
s_total = len(graph.skosConcepts)
# hack to make sure that we have a default top level object
JSON_DATA_CLASSES = json.dumps({'children' : c_mylist, 'name' : 'owl:Thing', 'id' : "None" })
JSON_DATA_PROPERTIES = json.dumps({'children' : p_mylist, 'name' : 'Properties', 'id' : "None" })
JSON_DATA_CONCEPTS = json.dumps({'children' : s_mylist, 'name' : 'Concepts', 'id' : "None" })
c = Context({
"ontology": ontology,
"main_uri" : uri,
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "sigmajs.html", "r")
t = Template(ontotemplate.read())
dict_graph = build_class_json(graph.classes)
JSON_DATA_CLASSES = json.dumps(dict_graph)
if False:
c_mylist = build_D3treeStandard(0, 99, 1, graph.toplayer)
p_mylist = build_D3treeStandard(0, 99, 1, graph.toplayerProperties)
s_mylist = build_D3treeStandard(0, 99, 1, graph.toplayerSkosConcepts)
c_total = len(graph.classes)
p_total = len(graph.properties)
s_total = len(graph.skosConcepts)
# hack to make sure that we have a default top level object
JSON_DATA_CLASSES = json.dumps({'children' : c_mylist, 'name' : 'owl:Thing', 'id' : "None" })
JSON_DATA_PROPERTIES = json.dumps({'children' : p_mylist, 'name' : 'Properties', 'id' : "None" })
JSON_DATA_CONCEPTS = json.dumps({'children' : s_mylist, 'name' : 'Concepts', 'id' : "None" })
c = Context({
"ontology": ontology,
"main_uri" : uri,
"STATIC_PATH": ONTOSPY_VIZ_STATIC,
"classes": graph.classes,
uri = ontology.uri
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "sigmajs.html", "r")
t = Template(ontotemplate.read())
dict_graph = build_class_json(graph.classes)
JSON_DATA_CLASSES = json.dumps(dict_graph)
if False:
c_mylist = build_D3treeStandard(0, 99, 1, graph.toplayer)
p_mylist = build_D3treeStandard(0, 99, 1, graph.toplayerProperties)
s_mylist = build_D3treeStandard(0, 99, 1, graph.toplayerSkosConcepts)
c_total = len(graph.classes)
p_total = len(graph.properties)
s_total = len(graph.skosConcepts)
# hack to make sure that we have a default top level object
JSON_DATA_CLASSES = json.dumps({'children' : c_mylist, 'name' : 'owl:Thing', 'id' : "None" })
JSON_DATA_PROPERTIES = json.dumps({'children' : p_mylist, 'name' : 'Properties', 'id' : "None" })
JSON_DATA_CONCEPTS = json.dumps({'children' : s_mylist, 'name' : 'Concepts', 'id' : "None" })
c = Context({
"ontology": ontology,
"main_uri" : uri,
"STATIC_PATH": ONTOSPY_VIZ_STATIC,
"""
"""
try:
ontology = graph.ontologies[0]
uri = ontology.uri
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "d3_partitionTable.html", "r")
t = Template(ontotemplate.read())
c_total = len(graph.classes)
mylist = build_D3treeStandard(0, 99, 1, graph.toplayer)
JSON_DATA_CLASSES = json.dumps({'children': mylist, 'name': 'owl:Thing',})
c = Context({
"ontology": ontology,
"main_uri" : uri,
"STATIC_PATH": ONTOSPY_VIZ_STATIC,
"save_on_github" : save_on_github,
'JSON_DATA_CLASSES' : JSON_DATA_CLASSES,
"TOTAL_CLASSES": c_total,
})
rnd = t.render(c)
return safe_str(rnd)
"""
"""
try:
ontology = graph.ontologies[0]
uri = ontology.uri
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "d3_cluster.html", "r")
t = Template(ontotemplate.read())
c_total = len(graph.classes)
mylist = build_D3treeStandard(0, 99, 1, graph.toplayer)
JSON_DATA_CLASSES = json.dumps({'children': mylist, 'name': 'owl:Thing',})
c = Context({
"ontology": ontology,
"main_uri" : uri,
"STATIC_PATH": ONTOSPY_VIZ_STATIC,
"save_on_github" : save_on_github,
'JSON_DATA_CLASSES' : JSON_DATA_CLASSES,
"TOTAL_CLASSES": c_total,
})
rnd = t.render(c)
return safe_str(rnd)
"""
"""
try:
ontology = graph.ontologies[0]
uri = ontology.uri
except:
ontology = None
uri = ";".join([s for s in graph.sources])
# ontotemplate = open("template.html", "r")
ontotemplate = open(ONTOSPY_VIZ_TEMPLATES + "d3_barHierarchy.html", "r")
t = Template(ontotemplate.read())
c_total = len(graph.classes)
mylist = build_D3treeStandard(0, 99, 1, graph.toplayer)
JSON_DATA_CLASSES = json.dumps({'children': mylist, 'name': 'owl:Thing',})
c = Context({
"ontology": ontology,
"main_uri" : uri,
"STATIC_PATH": ONTOSPY_VIZ_STATIC,
"save_on_github" : save_on_github,
'JSON_DATA_CLASSES' : JSON_DATA_CLASSES,
"TOTAL_CLASSES": c_total,
})
rnd = t.render(c)
return safe_str(rnd)