diff --git a/README.md b/README.md index ee285e3..dc4d44d 100755 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The same functionalities are accessible also via a command line application. Thi 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 --git a/docs/pages/changelog.md b/docs/pages/changelog.md index 2d1eae9..0125016 100755 --- a/docs/pages/changelog.md +++ b/docs/pages/changelog.md @@ -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 --git a/ontospy/gendocs/misc/scripts/export_all.py b/ontospy/gendocs/misc/scripts/export_all.py deleted file mode 100755 index e8db42e..0000000 --- a/ontospy/gendocs/misc/scripts/export_all.py +++ /dev/null @@ -1,151 +0,0 @@ -# !/usr/bin/env python -# -*- coding: UTF-8 -*- -""" -ONTODOCS -Copyright (c) 2013-2017 __Michele Pasin__ . -All rights reserved. - -> python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random - - -""" - -import click, sys -# http://click.pocoo.org/5/arguments/ -# http://click.pocoo.org/5/options/ -from .. import * -from ... import * # imports __init__ -from ...core import actions -from ...core.manager import get_home_location - -from ..viz_html_multi import KompleteViz, KompleteVizMultiModel -from ..actions import random_theme -import webbrowser - -CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) - - -@click.command(context_settings=CONTEXT_SETTINGS) -@click.argument('source', nargs=-1) -@click.option('--outputpath', '-o', help='Output path (default: home folder).') -@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.') -def cli_run_viz(source=None, outputpath="", theme="", verbose=False): - """ -This application is a wrapper on the main ontospy-viz script. It generates docs for all models in the local library. Using the Complex-html template.. -@todo allow to pass a custom folder .. - -> python -m ontospy.viz.scripts.export_all -o ~/Desktop/test/ --theme random - -""" - - 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") - - if source: - source_folder = source[0] - 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 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="green") - - 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 = """ - - - - - -

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 --git a/ontospy/gendocs/misc/scripts/__init__.py b/ontospy/scripts/__init__.py similarity index 100% rename from ontospy/gendocs/misc/scripts/__init__.py rename to ontospy/scripts/__init__.py