Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--individuals or -i leads to TypeError: 'method' object is not iterable, in colab #134

Open
susvej opened this issue Oct 31, 2023 · 1 comment

Comments

@susvej
Copy link

susvej commented Oct 31, 2023

I work in a colab, trying to generate documentation with instances from an ontology.

Command:
!ontospy gendocs -o /content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023docs/ontospy_gen_docs -i --type 2 /content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023/lingtempontology_oct24_2023_ontoology_rdf.owl -v

Expected result:
generation of documentation, including instances.

Actual result:

Ontospy v2.1.1
Loading graph...
Reading: </content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023/lingtempontology_oct24_2023_ontoology_rdf.owl>
.. trying rdf serialization: <xml>
..... success!
----------
Loaded 315 triples.
----------
RDF sources loaded successfully: 1 of 1.
..... '/content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023/lingtempontology_oct24_2023_ontoology_rdf.owl'
----------
Scanning entities...
----------
Ontologies.........: 1
Classes............: 10
Properties.........: 22
..annotation.......: 1
..datatype.........: 8
..object...........: 13
Concepts (SKOS)....: 0
Shapes (SHACL).....: 0
Individuals........: 41
----------
Building visualization...
Error: Pygmentize Failed
Error: Pygmentize Failed
Traceback (most recent call last):
  File "/usr/local/bin/ontospy", line 8, in <module>
    sys.exit(main_cli())
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.10/dist-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/click/decorators.py", line 33, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/ontospy/cli.py", line 303, in gendocs
    url = action_visualize(
  File "/usr/local/lib/python3.10/dist-packages/ontospy/core/actions.py", line 699, in action_visualize
    url = build_visualization(g, viztype, path, title, theme)
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/actions.py", line 147, in build_visualization
    url = v.build(path)
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/viz_factory.py", line 73, in build
    self.final_url = self._buildTemplates()
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/viz/viz_html_multi.py", line 208, in _buildTemplates
    contents = self._renderTemplate(
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/viz_factory.py", line 105, in _renderTemplate
    contents = safe_str(t.render(context))
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/media/templates/html-multi/browser/browser_individualinfo.html", line 1, in top-level template code
    {% extends "html-multi/base.html" %}
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/media/templates/html-multi/base.html", line 214, in top-level template code
    {% block bodycontent %}
  File "/usr/local/lib/python3.10/dist-packages/ontospy/gendocs/media/templates/html-multi/browser/browser_individualinfo.html", line 56, in block 'bodycontent'
    {% for s in each.instance_of %}
TypeError: 'method' object is not iterable

Please note that this command in the same colab generates all the documentation. The only difference is the absence of the -i or --individuals tag

Command: !ontospy gendocs -o /content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023docs/ontospy_gen_docs --type 2 /content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023/lingtempontology_oct24_2023_ontoology_rdf.owl

Result:

Loading graph...
Building visualization...
Error: Pygmentize Failed
Error: Pygmentize Failed
Done.
=> file:///content/drive/MyDrive/Temperatur/Ontology/LingTempOntOct2023docs/ontospy_gen_docs/index.html

-----------
Time:	   4.02s
@susvej
Copy link
Author

susvej commented Nov 3, 2023

Follow up: Running the code above will generate all class and property html sites, and will link the instances to them - but it will NOT generate html sites for the individuals.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant