diff -Nru ontospy-2.0.0~dfsg/debian/changelog ontospy-2.1.1~dfsg/debian/changelog --- ontospy-2.0.0~dfsg/debian/changelog 2022-11-10 17:50:00.000000000 +0000 +++ ontospy-2.1.1~dfsg/debian/changelog 2022-11-27 14:56:41.000000000 +0000 @@ -1,3 +1,14 @@ +ontospy (2.1.1~dfsg-1) unstable; urgency=medium + + [ upstream ] + * new release(s) + + [ Jonas Smedegaard ] + * unfuzz patches + * declare compliance with Debian Policy 4.6.1 + + -- Jonas Smedegaard Sun, 27 Nov 2022 15:56:41 +0100 + ontospy (2.0.0~dfsg-2) unstable; urgency=medium * update lintian source-is-missing overrides diff -Nru ontospy-2.0.0~dfsg/debian/control ontospy-2.1.1~dfsg/debian/control --- ontospy-2.0.0~dfsg/debian/control 2022-11-10 17:48:15.000000000 +0000 +++ ontospy-2.1.1~dfsg/debian/control 2022-11-26 10:17:50.000000000 +0000 @@ -32,7 +32,7 @@ python3-setuptools, python3-sparqlwrapper, toilet-fonts , -Standards-Version: 4.6.0 +Standards-Version: 4.6.1 Vcs-Git: https://salsa.debian.org/debian/ontospy.git Vcs-Browser: https://salsa.debian.org/debian/ontospy Homepage: https://lambdamusic.github.io/Ontospy/ diff -Nru ontospy-2.0.0~dfsg/debian/copyright_hints ontospy-2.1.1~dfsg/debian/copyright_hints --- ontospy-2.0.0~dfsg/debian/copyright_hints 2022-11-10 15:16:23.000000000 +0000 +++ ontospy-2.1.1~dfsg/debian/copyright_hints 2022-11-26 10:13:52.000000000 +0000 @@ -78,9 +78,6 @@ ontospy/gendocs/media/templates/d3/d3_pack_hierarchy.html ontospy/gendocs/media/templates/d3/d3_partition_table.html ontospy/gendocs/media/templates/d3/d3_rotating_cluster.html - ontospy/gendocs/media/templates/d3/d3_treePie.html - ontospy/gendocs/media/templates/d3/d3base.html - ontospy/gendocs/media/templates/d3/d3tree_hiddendivs.html ontospy/gendocs/media/templates/html-multi/base.html ontospy/gendocs/media/templates/html-multi/breadcrumbs.html ontospy/gendocs/media/templates/html-multi/browser/browser_conceptinfo.html @@ -100,6 +97,8 @@ ontospy/gendocs/media/templates/markdown/markdown_individualinfo.md ontospy/gendocs/media/templates/markdown/markdown_ontoinfo.md ontospy/gendocs/media/templates/markdown/markdown_propinfo.md + ontospy/gendocs/media/templates/shared/d3_base.html + ontospy/gendocs/media/templates/shared/d3_hiddendivs.html ontospy/gendocs/media/templates/shared/js_slidereveal.html ontospy/gendocs/media/templates/sigma/sigmajs.html ontospy/gendocs/misc/html-tests/d3_packhierarchy/d3test_static/d3.layout.js @@ -120,7 +119,6 @@ ontospy/gendocs/misc/html-tests/splitter.html ontospy/gendocs/misc/html-tests/template1.html ontospy/gendocs/misc/html-tests/treeTemplate.html - ontospy/gendocs/misc/scripts/__init__.py ontospy/gendocs/utils.py ontospy/gendocs/viz/README.md ontospy/gendocs/viz/__init__.py @@ -130,12 +128,13 @@ ontospy/gendocs/viz/viz_d3pack_hierarchy.py ontospy/gendocs/viz/viz_d3partition_table.py ontospy/gendocs/viz/viz_d3rotating_cluster.py - ontospy/gendocs/viz/viz_d3tree_pie.py ontospy/gendocs/viz/viz_html_multi.py ontospy/gendocs/viz/viz_html_single.py ontospy/gendocs/viz/viz_markdown.py ontospy/gendocs/viz/viz_sigmajs.py ontospy/gendocs/viz_factory.py + ontospy/scripts/__init__.py + ontospy/scripts/export_all.py ontospy/tests/__init__.py ontospy/tests/context.py ontospy/tests/quick.py @@ -196,9 +195,7 @@ Files: ontospy/core/utils.py ontospy/extras/hacks/server.py ontospy/extras/hacks/sketch.py - ontospy/gendocs/misc/scripts/export_all.py Copyright: 2010-2015 - 2013-2017 2014 2015 License: UNKNOWN diff -Nru ontospy-2.0.0~dfsg/debian/patches/1002_jquery.patch ontospy-2.1.1~dfsg/debian/patches/1002_jquery.patch --- ontospy-2.0.0~dfsg/debian/patches/1002_jquery.patch 2022-11-10 15:01:34.000000000 +0000 +++ ontospy-2.1.1~dfsg/debian/patches/1002_jquery.patch 2022-11-26 10:08:26.000000000 +0000 @@ -7,7 +7,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html +++ b/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html -@@ -108,7 +108,7 @@ +@@ -132,7 +132,7 @@ @@ -18,7 +18,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_bubble_chart.html +++ b/ontospy/gendocs/media/templates/d3/d3_bubble_chart.html -@@ -109,7 +109,7 @@ +@@ -125,7 +125,7 @@ @@ -29,7 +29,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_dendogram.html +++ b/ontospy/gendocs/media/templates/d3/d3_dendogram.html -@@ -204,7 +204,7 @@ +@@ -165,7 +165,7 @@ @@ -40,7 +40,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_pack_hierarchy.html +++ b/ontospy/gendocs/media/templates/d3/d3_pack_hierarchy.html -@@ -140,7 +140,7 @@ +@@ -159,7 +159,7 @@ @@ -51,7 +51,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_partition_table.html +++ b/ontospy/gendocs/media/templates/d3/d3_partition_table.html -@@ -181,7 +181,7 @@ +@@ -196,7 +196,7 @@ @@ -62,18 +62,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_rotating_cluster.html +++ b/ontospy/gendocs/media/templates/d3/d3_rotating_cluster.html -@@ -125,7 +125,7 @@ - - - -- -+ - - - ---- a/ontospy/gendocs/media/templates/d3/d3_treePie.html -+++ b/ontospy/gendocs/media/templates/d3/d3_treePie.html -@@ -97,7 +97,7 @@ +@@ -147,7 +147,7 @@ @@ -84,7 +73,7 @@ --- a/ontospy/gendocs/media/templates/sigma/sigmajs.html +++ b/ontospy/gendocs/media/templates/sigma/sigmajs.html -@@ -87,7 +87,7 @@ +@@ -76,7 +76,7 @@ diff -Nru ontospy-2.0.0~dfsg/debian/patches/1005_d3.patch ontospy-2.1.1~dfsg/debian/patches/1005_d3.patch --- ontospy-2.0.0~dfsg/debian/patches/1005_d3.patch 2022-11-10 15:00:28.000000000 +0000 +++ ontospy-2.1.1~dfsg/debian/patches/1005_d3.patch 2022-11-26 10:10:05.000000000 +0000 @@ -7,7 +7,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html +++ b/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html -@@ -106,7 +106,7 @@ +@@ -130,7 +130,7 @@ {# JAVASCRIPT #} @@ -18,7 +18,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_bubble_chart.html +++ b/ontospy/gendocs/media/templates/d3/d3_bubble_chart.html -@@ -107,7 +107,7 @@ +@@ -123,7 +123,7 @@ {# JAVASCRIPT #} @@ -29,7 +29,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_dendogram.html +++ b/ontospy/gendocs/media/templates/d3/d3_dendogram.html -@@ -201,8 +201,7 @@ +@@ -162,8 +162,7 @@ {% else %} @@ -41,7 +41,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_pack_hierarchy.html +++ b/ontospy/gendocs/media/templates/d3/d3_pack_hierarchy.html -@@ -138,7 +138,7 @@ +@@ -157,7 +157,7 @@ @@ -52,7 +52,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_partition_table.html +++ b/ontospy/gendocs/media/templates/d3/d3_partition_table.html -@@ -179,7 +179,7 @@ +@@ -194,7 +194,7 @@ {# JAVASCRIPT #} @@ -63,18 +63,7 @@ --- a/ontospy/gendocs/media/templates/d3/d3_rotating_cluster.html +++ b/ontospy/gendocs/media/templates/d3/d3_rotating_cluster.html -@@ -123,7 +123,7 @@ - - {# JAVASCRIPT #} - -- -+ - - - ---- a/ontospy/gendocs/media/templates/d3/d3_treePie.html -+++ b/ontospy/gendocs/media/templates/d3/d3_treePie.html -@@ -95,7 +95,7 @@ +@@ -145,7 +145,7 @@ {# JAVASCRIPT #} diff -Nru ontospy-2.0.0~dfsg/docs/pages/changelog.md ontospy-2.1.1~dfsg/docs/pages/changelog.md --- ontospy-2.0.0~dfsg/docs/pages/changelog.md 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/docs/pages/changelog.md 2022-11-16 14:24:23.000000000 +0000 @@ -2,6 +2,11 @@ Summary of changes. +## Nov, 2022: v 2.1.0 + +- D3 visualizations improvements + - Split pages for different object types + - Refactor code ## Oct, 2022: v 2.0.0 diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/CONFIG.py ontospy-2.1.1~dfsg/ontospy/gendocs/CONFIG.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/CONFIG.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/CONFIG.py 2022-11-16 14:24:23.000000000 +0000 @@ -24,17 +24,17 @@ }, { "ID": "d3-bubble-chart", - "Title": "D3 Bubble chart [alpha]", + "Title": "D3 Bubble chart", "Description": "@todo", }, { "ID": "d3-pack-hierarchy", - "Title": "D3 Pack hierarchy [alpha]", + "Title": "D3 Pack hierarchy", "Description": "@todo", }, { "ID": "d3-bar-hierarchy", - "Title": "D3 Bar hierarchy [alpha]", + "Title": "D3 Bar hierarchy", "Description": "@todo", }, { diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/jinja_env.py ontospy-2.1.1~dfsg/ontospy/gendocs/jinja_env.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/jinja_env.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/jinja_env.py 2022-11-16 14:24:23.000000000 +0000 @@ -40,13 +40,16 @@ @pass_eval_context def linebreaks_filter(eval_ctx, value): """A filter for legacy django templates.""" - if not value: - return "" - result = u'\n\n'.join(u'

%s

' % p.replace('\n', '
\n') - for p in _paragraph_re.split(escape(value))) - if eval_ctx.autoescape: - result = Markup(result) - return result + try: + if not value: + return "" + result = u'\n\n'.join(u'

%s

' % p.replace('\n', '
\n') + for p in _paragraph_re.split(escape(value))) + if eval_ctx.autoescape: + result = Markup(result) + return result + except: + return value env.filters['linebreaks'] = linebreaks_filter @@ -99,3 +102,22 @@ env.filters['truncatewords'] = truncatewords_filter + + + +# +# FILTER +# + + +def d3_dendogram_height_filter(tot_objects): + """A filter to generate dynamically the min height of a dendogram.""" + n = 50 * tot_objects + if n < 800: + return 800 + else: + return n + + +env.filters['d3_dendogram_height'] = d3_dendogram_height_filter + diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html --- ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/d3/d3_bar_hierarchy.html 2022-11-16 14:24:23.000000000 +0000 @@ -1,4 +1,4 @@ -{% extends "d3/d3base.html" %} +{% extends "shared/d3_base.html" %} @@ -39,9 +39,9 @@ .bde { - background: yellow; - font-size: 21px; - font-family: monospace; + background: lightgoldenrodyellow; + /* font-size: 21px; */ + /* font-family: monospace; */ display: inline; } @@ -49,6 +49,7 @@ background: white; } + {% endblock custom_css %} @@ -61,25 +62,48 @@ +
+ + + + + {% if TOTAL_CLASSES %} + Classes ({{TOTAL_CLASSES}})   + {% endif %} + + {% if TOTAL_PROPERTIES %} + Properties ({{TOTAL_PROPERTIES}})   + {% endif %} + + {% if TOTAL_CONCEPTS %} + Concepts ({{TOTAL_CONCEPTS}}) + {% endif %} + + + + +
+ + +
- {% if TOTAL_CLASSES %} -
-

Classes ({{TOTAL_CLASSES}})

- +

+ + + +
-
-
+
-
- {% endif %} +
@@ -124,7 +148,7 @@ - - - - - - -{% include 'shared/js_slidereveal.html' %} - - - - - - - - - - - - - {% endblock the_javascript %} - - - - diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/html-single/html-single.html ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/html-single/html-single.html --- ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/html-single/html-single.html 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/html-single/html-single.html 2022-11-16 14:24:23.000000000 +0000 @@ -228,20 +228,25 @@ - - - {% if ontologies|length > 1 %} -

{{docs_title}}

+ {% if ontologies%} - {% for o in ontologies %} -

  • {{o.uri}}
  • - {% endfor %} + {% if ontologies|length > 1 %} +

    {{docs_title}}

    + {% for o in ontologies %} +

  • {{o.uri}}
  • + {% endfor %} + + {% else %} +

    {{docs_title}}

    +

    {{ontologies.0.bestDescription()|linebreaks}}

    + {% endif %} + {% else %} -

    {{docs_title}}

    -

    {{ontologies.0.bestDescription()|linebreaks}}

    +

    {{docs_title}}

    {% endif %} +

    Ontology documentation automatically generated by Ontospy on {% now 'utc', '%a, %d %b %Y %H:%M:%S' %}

    diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/shared/d3_base.html ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/shared/d3_base.html --- ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/shared/d3_base.html 1970-01-01 00:00:00.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/shared/d3_base.html 2022-11-16 14:24:23.000000000 +0000 @@ -0,0 +1,196 @@ + + + + +Ontospy > {{docs_title}} + + + + + + + + + +{% block custom_css %} + + + +{% endblock custom_css %} + + + + + + + + + + + + {# VISIBLE PAGE HTML #} + + {# note: showpanel arg is the ID of the div that is showing.. #} + +

    {{docs_title}}

    + +
    + + + + + {% block main_content %} + + + {% endblock main_content %} + + + + +
    + Ontology documentation automatically generated with Ontospy on {% now 'utc', '%a, %d %b %Y %H:%M:%S' %}. + + {% block extra_footer %} + + + {% endblock extra_footer %} + + + + + {# SLIDER AND HIDDEN TABS #} + + {% include "shared/d3_hiddendivs.html" %} + + +
    + Press ESC to close +
    +
    + + {# #} + + + + + + + {% block the_javascript %} + + + {% endblock the_javascript %} + + + + + + + diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/shared/d3_hiddendivs.html ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/shared/d3_hiddendivs.html --- ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/shared/d3_hiddendivs.html 1970-01-01 00:00:00.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/shared/d3_hiddendivs.html 2022-11-16 14:24:23.000000000 +0000 @@ -0,0 +1,311 @@ + + +{# hidden divs for d3 viz - shown within slider #} + + + + + + +{% for each in classes %} + + + + +{% endfor %} + + + + + + +{# PROPERTIES SECTION #} + + +{% for each in properties %} + + + +{% endfor %} + + + + + + + +{# SKOS CONCEPTS SECTION #} + + +{% for each in skosConcepts %} + + + +{% endfor %} + + + + + + + + + +{# INDIVIDUALS SECTION #} + + +{% for each in individuals %} + + + +{% endfor %} + + diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/sigma/sigmajs.html ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/sigma/sigmajs.html --- ontospy-2.0.0~dfsg/ontospy/gendocs/media/templates/sigma/sigmajs.html 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/media/templates/sigma/sigmajs.html 2022-11-16 14:24:23.000000000 +0000 @@ -1,5 +1,5 @@ -{% extends "d3/d3base.html" %} +{% extends "shared/d3_base.html" %} @@ -11,28 +11,6 @@ - - -

    Ontospy-generated documentation:

    -%s - - - """ - with open(report_path, "w") as text_file: - text_file.write(html % ("".join([x for x in report_pages]))) - # open report - webbrowser.open("file:///" + report_path) - - raise SystemExit(1) - - -if __name__ == '__main__': - try: - # http://stackoverflow.com/questions/32553969/modify-usage-string-on-click-command-line-interface-on-windows - cli_run_viz(prog_name='ontospy-viz') - sys.exit(0) - except KeyboardInterrupt as e: # Ctrl-C - raise e diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/misc/scripts/__init__.py ontospy-2.1.1~dfsg/ontospy/gendocs/misc/scripts/__init__.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/misc/scripts/__init__.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/misc/scripts/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -# !/usr/bin/env python -# -*- coding: UTF-8 -*- diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/README.md ontospy-2.1.1~dfsg/ontospy/gendocs/viz/README.md --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/README.md 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/README.md 2022-11-16 14:24:23.000000000 +0000 @@ -6,5 +6,5 @@ ### Testing locally -- `python -m ontospy.gendocs.viz.viz_d3barHierarchy` picks a random ontology and runs the script +- `python -m ontospy.gendocs.viz.viz_d3bar_hierarchy` picks a random ontology and runs the script - `python -m ontospy.gendocs.viz.viz_html_single` \ No newline at end of file diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3bar_hierarchy.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3bar_hierarchy.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3bar_hierarchy.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3bar_hierarchy.py 2022-11-16 14:24:23.000000000 +0000 @@ -31,26 +31,109 @@ OVERRIDING THIS METHOD from Factory """ - jsontree_classes = build_D3treeStandard( - 0, 99, 1, self.ontospy_graph.toplayer_classes) c_total = len(self.ontospy_graph.all_classes) + p_total = len(self.ontospy_graph.all_properties) + s_total = len(self.ontospy_graph.all_skos_concepts) - JSON_DATA_CLASSES = json.dumps({ - 'children': jsontree_classes, - 'name': 'owl:Thing', - }) - - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_bar_hierarchy.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) + main_url = None + + + if c_total: + c_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_classes) + # 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" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "classes", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": c_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_classes), + 'JSON_DATA_OBJECTS': JSON_DATA_CLASSES, + } + + # Classes - MAIN PAGE + contents = self._renderTemplate( + "d3/d3_bar_hierarchy.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "classes.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + + if p_total: + p_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_properties) + JSON_DATA_PROPERTIES = json.dumps({ + 'children': p_mylist, + 'name': 'Properties', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "properties", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": p_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_properties), + 'JSON_DATA_OBJECTS': JSON_DATA_PROPERTIES, + } + + # Properties PAGE + contents = self._renderTemplate( + "d3/d3_bar_hierarchy.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "properties.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + if s_total: + s_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_skos) + JSON_DATA_CONCEPTS = json.dumps({ + 'children': s_mylist, + 'name': 'Concepts', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "concepts", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": s_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), + 'JSON_DATA_OBJECTS': JSON_DATA_CONCEPTS, + } + + # Concepts PAGE + contents = self._renderTemplate( + "d3/d3_bar_hierarchy.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "skos.html" + self._save2File(contents, FILE_NAME, self.output_path) return main_url diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3bubble_chart.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3bubble_chart.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3bubble_chart.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3bubble_chart.py 2022-11-16 14:24:23.000000000 +0000 @@ -31,28 +31,111 @@ OVERRIDING THIS METHOD from Factory """ - jsontree_classes = build_D3bubbleChart( - 0, 99, 1, self.ontospy_graph.toplayer_classes) c_total = len(self.ontospy_graph.all_classes) + p_total = len(self.ontospy_graph.all_properties) + s_total = len(self.ontospy_graph.all_skos_concepts) - JSON_DATA_CLASSES = json.dumps({ - 'children': jsontree_classes, - 'name': 'owl:Thing', - }) - - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_bubble_chart.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) + main_url = None + + if c_total: + c_mylist = build_D3bubbleChart(0, 99, 1, + self.ontospy_graph.toplayer_classes) + # 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" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "classes", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": c_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_classes), + 'JSON_DATA_OBJECTS': JSON_DATA_CLASSES, + } + + # Classes - MAIN PAGE + contents = self._renderTemplate( + "d3/d3_bubble_chart.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "classes.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + + if p_total: + p_mylist = build_D3bubbleChart(0, 99, 1, + self.ontospy_graph.toplayer_properties) + JSON_DATA_PROPERTIES = json.dumps({ + 'children': p_mylist, + 'name': 'Properties', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "properties", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": p_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_properties), + 'JSON_DATA_OBJECTS': JSON_DATA_PROPERTIES, + } + + # Properties PAGE + contents = self._renderTemplate( + "d3/d3_bubble_chart.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "properties.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + if s_total: + s_mylist = build_D3bubbleChart(0, 99, 1, + self.ontospy_graph.toplayer_skos) + JSON_DATA_CONCEPTS = json.dumps({ + 'children': s_mylist, + 'name': 'Concepts', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "concepts", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": s_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), + 'JSON_DATA_OBJECTS': JSON_DATA_CONCEPTS, + } + + # Concepts PAGE + contents = self._renderTemplate( + "d3/d3_bubble_chart.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "skos.html" + self._save2File(contents, FILE_NAME, self.output_path) return main_url + # if called directly, for testing purposes pick a random ontology diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3dendogram.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3dendogram.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3dendogram.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3dendogram.py 2022-11-16 14:24:23.000000000 +0000 @@ -32,17 +32,13 @@ OVERRIDING THIS METHOD from Factory """ - c_mylist = build_D3treeStandard(0, 99, 1, - self.ontospy_graph.toplayer_classes) - p_mylist = build_D3treeStandard(0, 99, 1, - self.ontospy_graph.toplayer_properties) - s_mylist = build_D3treeStandard(0, 99, 1, - self.ontospy_graph.toplayer_skos) - c_total = len(self.ontospy_graph.all_classes) p_total = len(self.ontospy_graph.all_properties) s_total = len(self.ontospy_graph.all_skos_concepts) + main_url = None + + if False: # testing how a single tree would look like JSON_DATA_CLASSES = json.dumps({ @@ -67,41 +63,103 @@ "root" }) - # 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" - }) - - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - "TOTAL_PROPERTIES": p_total, - "TOTAL_CONCEPTS": s_total, - "TOTAL_CLASSES_TOPLAYER": len(self.ontospy_graph.toplayer_classes), - "TOTAL_PROPERTIES_TOPLAYER": len(self.ontospy_graph.toplayer_properties), - "TOTAL_CONCEPTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - 'JSON_DATA_PROPERTIES': JSON_DATA_PROPERTIES, - 'JSON_DATA_CONCEPTS': JSON_DATA_CONCEPTS, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_dendogram.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) + if c_total: + c_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_classes) + # 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" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "classes", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": c_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_classes), + 'JSON_DATA_OBJECTS': JSON_DATA_CLASSES, + } + + # Classes - MAIN PAGE + contents = self._renderTemplate( + "d3/d3_dendogram.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "classes.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + + if p_total: + p_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_properties) + JSON_DATA_PROPERTIES = json.dumps({ + 'children': p_mylist, + 'name': 'Properties', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "properties", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": p_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_properties), + 'JSON_DATA_OBJECTS': JSON_DATA_PROPERTIES, + } + + # Properties PAGE + contents = self._renderTemplate( + "d3/d3_dendogram.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "properties.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + if s_total: + s_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_skos) + JSON_DATA_CONCEPTS = json.dumps({ + 'children': s_mylist, + 'name': 'Concepts', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "concepts", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": s_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), + 'JSON_DATA_OBJECTS': JSON_DATA_CONCEPTS, + } + + # Concepts PAGE + contents = self._renderTemplate( + "d3/d3_dendogram.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "skos.html" + self._save2File(contents, FILE_NAME, self.output_path) + return main_url diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3pack_hierarchy.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3pack_hierarchy.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3pack_hierarchy.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3pack_hierarchy.py 2022-11-16 14:24:23.000000000 +0000 @@ -32,35 +32,139 @@ OVERRIDING THIS METHOD from Factory """ - jsontree_classes = build_D3treeStandard( - 0, 99, 1, self.ontospy_graph.toplayer_classes) c_total = len(self.ontospy_graph.all_classes) + p_total = len(self.ontospy_graph.all_properties) + s_total = len(self.ontospy_graph.all_skos_concepts) - if len(self.ontospy_graph.toplayer_classes) == 1: - # the first element can be the single top level - JSON_DATA_CLASSES = json.dumps(jsontree_classes[0]) - else: + main_url = None + + + if False: + # testing how a single tree would look like + JSON_DATA_CLASSES = json.dumps({ + 'children': [{ + 'children': c_mylist, + 'name': 'Classes', + 'id': "classes" + }, + { + 'children': p_mylist, + 'name': 'Properties', + 'id': "properties" + }, + { + 'children': s_mylist, + 'name': 'Concepts', + 'id': "concepts" + }], + 'name': + 'Entities', + 'id': + "root" + }) + + if c_total: + c_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_classes) # hack to make sure that we have a default top level object JSON_DATA_CLASSES = json.dumps({ - 'children': jsontree_classes, + 'children': c_mylist, 'name': 'owl:Thing', + 'id': "None" }) - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_pack_hierarchy.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "classes", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": c_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_classes), + 'JSON_DATA_OBJECTS': JSON_DATA_CLASSES, + } + + # Classes - MAIN PAGE + contents = self._renderTemplate( + "d3/d3_pack_hierarchy.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "classes.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + + if p_total: + p_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_properties) + JSON_DATA_PROPERTIES = json.dumps({ + 'children': p_mylist, + 'name': 'Properties', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "properties", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": p_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_properties), + 'JSON_DATA_OBJECTS': JSON_DATA_PROPERTIES, + } + + # Properties PAGE + contents = self._renderTemplate( + "d3/d3_pack_hierarchy.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "properties.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + if s_total: + s_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_skos) + JSON_DATA_CONCEPTS = json.dumps({ + 'children': s_mylist, + 'name': 'Concepts', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "concepts", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": s_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), + 'JSON_DATA_OBJECTS': JSON_DATA_CONCEPTS, + } + + # Concepts PAGE + contents = self._renderTemplate( + "d3/d3_pack_hierarchy.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "skos.html" + self._save2File(contents, FILE_NAME, self.output_path) + return main_url + # if called directly, for testing purposes pick a random ontology if __name__ == '__main__': diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3partition_table.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3partition_table.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3partition_table.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3partition_table.py 2022-11-16 14:24:23.000000000 +0000 @@ -31,29 +31,111 @@ OVERRIDING THIS METHOD from Factory """ - jsontree_classes = build_D3treeStandard( - 0, 99, 1, self.ontospy_graph.toplayer_classes) c_total = len(self.ontospy_graph.all_classes) + p_total = len(self.ontospy_graph.all_properties) + s_total = len(self.ontospy_graph.all_skos_concepts) - JSON_DATA_CLASSES = json.dumps({ - 'children': jsontree_classes, - 'name': 'owl:Thing', - }) - - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_partition_table.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) + main_url = None + + if c_total: + c_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_classes) + # 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" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "classes", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": c_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_classes), + 'JSON_DATA_OBJECTS': JSON_DATA_CLASSES, + } + + # Classes - MAIN PAGE + contents = self._renderTemplate( + "d3/d3_partition_table.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "classes.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + + if p_total: + p_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_properties) + JSON_DATA_PROPERTIES = json.dumps({ + 'children': p_mylist, + 'name': 'Properties', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "properties", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": p_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_properties), + 'JSON_DATA_OBJECTS': JSON_DATA_PROPERTIES, + } + + # Properties PAGE + contents = self._renderTemplate( + "d3/d3_partition_table.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "properties.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + if s_total: + s_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_skos) + JSON_DATA_CONCEPTS = json.dumps({ + 'children': s_mylist, + 'name': 'Concepts', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "concepts", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": s_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), + 'JSON_DATA_OBJECTS': JSON_DATA_CONCEPTS, + } + + # Concepts PAGE + contents = self._renderTemplate( + "d3/d3_partition_table.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "skos.html" + self._save2File(contents, FILE_NAME, self.output_path) - return main_url + return main_url # if called directly, for testing purposes pick a random ontology diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3rotating_cluster.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3rotating_cluster.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3rotating_cluster.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3rotating_cluster.py 2022-11-16 14:24:23.000000000 +0000 @@ -33,30 +33,113 @@ OVERRIDING THIS METHOD from Factory """ - jsontree_classes = build_D3treeStandard( - 0, 99, 1, self.ontospy_graph.toplayer_classes) c_total = len(self.ontospy_graph.all_classes) + p_total = len(self.ontospy_graph.all_properties) + s_total = len(self.ontospy_graph.all_skos_concepts) - JSON_DATA_CLASSES = json.dumps({ - 'children': jsontree_classes, - 'name': 'owl:Thing', - }) - - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_rotating_cluster.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) + main_url = None + + if c_total: + c_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_classes) + # 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" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "classes", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": c_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_classes), + 'JSON_DATA_OBJECTS': JSON_DATA_CLASSES, + } + + # Classes - MAIN PAGE + contents = self._renderTemplate( + "d3/d3_rotating_cluster.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "classes.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + + if p_total: + p_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_properties) + JSON_DATA_PROPERTIES = json.dumps({ + 'children': p_mylist, + 'name': 'Properties', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "properties", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": p_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_properties), + 'JSON_DATA_OBJECTS': JSON_DATA_PROPERTIES, + } + + # Properties PAGE + contents = self._renderTemplate( + "d3/d3_rotating_cluster.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "properties.html" + self._save2File(contents, FILE_NAME, self.output_path) + + + if s_total: + s_mylist = build_D3treeStandard(0, 99, 1, + self.ontospy_graph.toplayer_skos) + JSON_DATA_CONCEPTS = json.dumps({ + 'children': s_mylist, + 'name': 'Concepts', + 'id': "None" + }) + + extra_context = { + "ontograph": self.ontospy_graph, + "thispage": "concepts", + "TOTAL_CLASSES": c_total, + "TOTAL_PROPERTIES": p_total, + "TOTAL_CONCEPTS": s_total, + "TOTAL_OBJECTS": s_total, + "TOTAL_OBJECTS_TOPLAYER": len(self.ontospy_graph.toplayer_skos), + 'JSON_DATA_OBJECTS': JSON_DATA_CONCEPTS, + } + + # Concepts PAGE + contents = self._renderTemplate( + "d3/d3_rotating_cluster.html", extraContext=extra_context) + + if not main_url: + FILE_NAME = "index.html" + main_url = self._save2File(contents, FILE_NAME, self.output_path) + else: + FILE_NAME = "skos.html" + self._save2File(contents, FILE_NAME, self.output_path) - return main_url + return main_url + # if called directly, for testing purposes pick a random ontology if __name__ == '__main__': diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3tree_pie.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3tree_pie.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_d3tree_pie.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_d3tree_pie.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -# !/usr/bin/env python -# -*- coding: UTF-8 -*- - - -# =========== -# D3 TREE PIE -# -# NOT IN USE / NEEDS MORE TESTING -# =========== - - - - - - - -import os, sys -import json - -from ..utils import * -from ..actions import * -from ..viz_factory import VizFactory - - - -class Dataviz(VizFactory): - """ - D3 TREE PIE - - """ - - def __init__(self, ontospy_graph, title=""): - """ - Init - """ - super(Dataviz, self).__init__(ontospy_graph, title) - self.static_files = ["libs/d3-v3", "libs/jquery"] - - def _buildTemplates(self): - """ - OVERRIDING THIS METHOD from Factory - """ - - jsontree_classes = build_D3treepie(0, 99, 1, - self.ontospy_graph.toplayer_classes) - c_total = len(self.ontospy_graph.all_classes) - c_toplayer = len(self.ontospy_graph.toplayer_classes) - - # weird - DBCheck! - JSON_DATA_CLASSES = json.dumps( - ["owl:Thing", [c_toplayer, c_toplayer], jsontree_classes]) - - extra_context = { - "ontograph": self.ontospy_graph, - "TOTAL_CLASSES": c_total, - 'JSON_DATA_CLASSES': JSON_DATA_CLASSES, - } - - # Ontology - MAIN PAGE - contents = self._renderTemplate( - "d3/d3_treepie.html", extraContext=extra_context) - FILE_NAME = "index.html" - main_url = self._save2File(contents, FILE_NAME, self.output_path) - - return main_url - - -# if called directly, for testing purposes pick a random ontology - -if __name__ == '__main__': - - TEST_ONLINE = False - try: - - g = get_onto_for_testing(TEST_ONLINE) - - v = Dataviz(g, title="") - v.build() - v.preview() - - sys.exit(0) - - except KeyboardInterrupt as e: # Ctrl-C - raise e diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_sigmajs.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_sigmajs.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz/viz_sigmajs.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz/viz_sigmajs.py 2022-11-16 14:24:23.000000000 +0000 @@ -40,11 +40,13 @@ c_mydict = build_class_json(self.ontospy_graph.all_classes) JSON_DATA_CLASSES = json.dumps(c_mydict) + c_total = len(self.ontospy_graph.all_classes) extra_context = { "ontograph": self.ontospy_graph, 'JSON_DATA_CLASSES' : JSON_DATA_CLASSES, + "TOTAL_CLASSES": c_total, } # Ontology - MAIN PAGE diff -Nru ontospy-2.0.0~dfsg/ontospy/gendocs/viz_factory.py ontospy-2.1.1~dfsg/ontospy/gendocs/viz_factory.py --- ontospy-2.0.0~dfsg/ontospy/gendocs/viz_factory.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/gendocs/viz_factory.py 2022-11-16 14:24:23.000000000 +0000 @@ -41,7 +41,7 @@ self.output_path = None self.output_path_static = None home = os.path.expanduser("~") - self.output_path_DEFAULT = os.path.join(home, "ontospy-viz-test") + self.output_path_DEFAULT = os.path.join(home, "ontospy-viz") self.template_name = "" self.main_file_name = "" self.templates_root = ONTODOCS_VIZ_TEMPLATES diff -Nru ontospy-2.0.0~dfsg/ontospy/scripts/export_all.py ontospy-2.1.1~dfsg/ontospy/scripts/export_all.py --- ontospy-2.0.0~dfsg/ontospy/scripts/export_all.py 1970-01-01 00:00:00.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/scripts/export_all.py 2022-11-16 14:24:23.000000000 +0000 @@ -0,0 +1,162 @@ +# !/usr/bin/env python +# -*- coding: UTF-8 -*- +""" +Script to generate docs for all models in the local library. Using the Complex-html template. + +> python -m ontospy.scripts.export_all -o ~/Desktop/test/ --theme random + + +""" + +import os +import click, sys +# http://click.pocoo.org/5/arguments/ +# http://click.pocoo.org/5/options/ +from .. import * +from ..core import actions +from ..core.manager import get_home_location, get_localontologies +from ..core.utils import * + +from ..gendocs.viz.viz_html_multi import KompleteViz, KompleteVizMultiModel +from ..gendocs.actions import random_theme +from ..gendocs.CONFIG import BOOTSWATCH_THEME_DEFAULT +import webbrowser + +CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) + + +@click.command(context_settings=CONTEXT_SETTINGS) +@click.option('--inputpath', '-i', help='Input path (default: ontospy home folder).') +@click.option('--outputpath', '-o', help='Output path (default: ~/ontospy-viz-multi).') +@click.option( + '--theme', + help= + 'CSS Theme for the html-complex visualization (random=use a random theme).' +) +@click.option('--verbose', is_flag=True, help='Verbose mode.') +@click.pass_context +def cli_run_viz(ctx, inputpath="", outputpath="", theme="", verbose=False): + """ +This application is a wrapper on the main ontospy-gendocs utility. It generates docs for all models in the local library. Using the Complex-html template.. + +> python -m ontospy.scripts.scripts.export_all -o ~/Desktop/ontodocs/ -o ~/Desktop/ontodocs/ --theme random + +""" + + printDebug("Ontospy " + VERSION, "comment") + if not inputpath and not outputpath and not theme: + printDebug(ctx.get_help()) + return + + if outputpath: + if not (os.path.exists(outputpath)) or not (os.path.isdir(outputpath)): + click.secho( + "WARNING: the -o option must include a valid directory path.", + fg="red") + sys.exit(0) + else: + from os.path import expanduser + home = expanduser("~") + outputpath = os.path.join(home, "ontospy-viz-multi") + printDebug(f"Using default output path: {outputpath}", dim=True) + + if inputpath: + source_folder = inputpath + if not os.path.isdir(source_folder): + click.secho( + "WARNING: '%s' is not a valid directory path." % source_folder, + fg="red") + sys.exit(0) + + files_list = [ + f for f in os.listdir(source_folder) + if os.path.isfile(os.path.join(source_folder, f)) + ] + click.secho( + "Exporting the directory: '%s'" % source_folder, fg="green") + click.secho("----------", fg="green") + + else: + click.secho( + "Exporting the local library: '%s'" % get_home_location(), + fg="green") + click.secho("----------", fg="green") + files_list = get_localontologies() + source_folder = get_home_location() + + report_pages = [] + + for onto_name in sorted(files_list): + + full_uri = os.path.join(source_folder, onto_name) + if theme: + if theme == "random": + _theme = random_theme() + else: + _theme = theme + else: + _theme = BOOTSWATCH_THEME_DEFAULT + click.secho("Onto: <%s> Theme: '%s'" % (onto_name, _theme), fg="red") + + printDebug("Loading graph...", dim=True) + g = Ontospy(os.path.join(source_folder, onto_name), verbose=verbose) + if g.sources: + # if Ontospy graph has no valid 'sources' = file passed was not valid RDF + printDebug("Building visualization...", dim=True) + onto_name_safe = slugify(unicode(onto_name)) + onto_outputpath = os.path.join(outputpath, onto_name_safe) + # note: single static files output path + static_outputpath = os.path.join(outputpath, "static") + # v = KompleteViz(g, theme=_theme) + v = KompleteVizMultiModel( + g, + theme=_theme, + static_url="../static/", + output_path_static=static_outputpath) + try: + # note: onto_outputpath is wiped out each time as part of the build + url = v.build(onto_outputpath) + report_pages.append( + "
  • %s ('%s' theme)
  • " + % (onto_name_safe, onto_name, _theme)) + except: + e = sys.exc_info()[0] + printDebug("Error: " + str(e), "red") + continue + + # generate a report page + report_path = os.path.join(outputpath, "index.html") + html = """ + + + + + +

    Examples of ontology documentation generated with Ontospy

    +

    Source code on GitHub

    +
    +
      +%s +
    + + + """ + with open(report_path, "w") as text_file: + text_file.write(html % ("".join([x for x in report_pages]))) + # open report + webbrowser.open("file:///" + report_path) + + raise SystemExit(1) + + +if __name__ == '__main__': + try: + # http://stackoverflow.com/questions/32553969/modify-usage-string-on-click-command-line-interface-on-windows + cli_run_viz(prog_name='ontospy-viz') + sys.exit(0) + except KeyboardInterrupt as e: # Ctrl-C + raise e diff -Nru ontospy-2.0.0~dfsg/ontospy/scripts/__init__.py ontospy-2.1.1~dfsg/ontospy/scripts/__init__.py --- ontospy-2.0.0~dfsg/ontospy/scripts/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/scripts/__init__.py 2022-11-16 14:24:23.000000000 +0000 @@ -0,0 +1,2 @@ +# !/usr/bin/env python +# -*- coding: UTF-8 -*- diff -Nru ontospy-2.0.0~dfsg/ontospy/VERSION.py ontospy-2.1.1~dfsg/ontospy/VERSION.py --- ontospy-2.0.0~dfsg/ontospy/VERSION.py 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/ontospy/VERSION.py 2022-11-16 14:24:23.000000000 +0000 @@ -8,7 +8,7 @@ # note: 1.8 major update with ontodocs split ################## -__version__ = "2.0.0" # Pypi latest: https://pypi.org/project/ontospy/ +__version__ = "2.1.1" # Pypi latest: https://pypi.org/project/ontospy/ __copyright__ = "CopyRight (C) 2015-2022 by Michele Pasin" __license__ = "GNU" diff -Nru ontospy-2.0.0~dfsg/README.md ontospy-2.1.1~dfsg/README.md --- ontospy-2.0.0~dfsg/README.md 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/README.md 2022-11-16 14:24:23.000000000 +0000 @@ -26,7 +26,7 @@ Ontospy can be used to generate HTML documentation for an ontology pretty much out-of-the-box. -See the website [Examples of ontology documentation generated via Ontospy](https://lambdamusic.github.io/ontospy-examples/index.html), or jump straight to the sample [Schema.org](https://lambdamusic.github.io/ontospy-examples/schema_org_topbraidttl/index.html) or [FOAF](https://lambdamusic.github.io/ontospy-examples/foafrdf/index.html) documentation pages. +See the website [Examples of ontology documentation generated via Ontospy](https://lambdamusic.github.io/ontospy-examples/index.html), or jump straight to the sample [CIDOC-CRM](https://lambdamusic.github.io/ontospy-examples/cidoccrm_ecrm-2022-11owlxml/index.html) or [FOAF](https://lambdamusic.github.io/ontospy-examples/foafrdf/index.html) documentation pages. > From version 2.0, the documentation generation libraries are installed by default with Ontospy. Previously, third party dependencies (e.g. Django) had to be installed separately. diff -Nru ontospy-2.0.0~dfsg/requirements.txt ontospy-2.1.1~dfsg/requirements.txt --- ontospy-2.0.0~dfsg/requirements.txt 2022-10-30 16:07:02.000000000 +0000 +++ ontospy-2.1.1~dfsg/requirements.txt 2022-11-16 14:24:23.000000000 +0000 @@ -8,7 +8,7 @@ pyparsing>=2.1.10 jinja2>=3.1.2 # for gendocs jinja2-time>=0.2.0 # for gendocs -pygments==2.1.3 # for gendocs +pygments==2.7.4 # for gendocs # readline==6.2.4.1 # optional, for shell autocomplete