Closed ImanoWilliams closed 2 years ago
Ontospy does not include any out of the box functionality for Django, but you can use the library like any other Python data processor.
For example
#
# in views.py
#
def ontology_page(request, uri=""):
context = {}
templatee = "my-ontology-template.html"
# ..
# .. set ontospy opts
#
g = Ontospy(
URI,
verbose=verbose,
pref_title=preflabel,
pref_lang=preflang,
hide_base_schemas=hide_base_schemas,
hide_implicit_types=hide_implicit_types,
hide_implicit_preds=hide_implicit_preds,
hide_individuals=hide_individuals)
context_data = {
"topclasses": g.topclasses,
"classes": g.all_classes,
"properties": g.all_properties,
# etc...
}
return render(request, templatee, context)
Then in the template you simply render the ontology properties using HTML.
For example, see https://github.com/lambdamusic/Ontospy/blob/v1.9.9.1/ontospy/ontodocs/media/templates/html-single/html-single.html - this template is used by the ontospy gendocs
command but that's basically a Django template..
Hi, I have a Django application that user can query an ontology. I would like to know how I could visualize my ontology using Ontospy using Django. I see where there is Ontowebspy that is now archived.