Module failures when running examples notebook
When running the examples.ipynb notebook, it failed to successfully load the as_json_obj and the yamlmagic would not work correctly. Specifically:
import jsonasobj.as_json_obj ## ERROR: I'm getting error No module named 'jsonasobj.as_json_obj'
and
%%yaml --loader DupCheckYamlLoader yaml
## ERROR: running this cell produces 2 errors:
## 1. Javascript Error: require is not defined
## 2. File "<ipython-input-3-f6f890ca4330>", line 4
## id: http://example.org/sample/example1
^
## SyntaxError: invalid syntax
I order to work around these errors I had to make a number of changes. I am attaching my notebook exapmple-debug.ipynb (in a zip file)
to show how I did this. Comment marked ## ERROR: show where I had issues.
can you clarify, did you run the necessary install steps?
Steps:
- install a venv:
python -m venv .env - activate the venv
- install
requirement.txt - run jupyter lab
- within jupyter lab, open and run
examples.ipynb
This results in the error:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-f82244ba019b> in <module>
2 from types import ModuleType
3 from json import loads, dumps
----> 4 from jsonasobj import JsonObj, as_json_object
5 from rdflib import Graph
6
ImportError: cannot import name 'as_json_object' from 'jsonasobj' (/Users/wdduncan/opt/anaconda3/lib/python3.7/site-packages/jsonasobj/__init__.py)
To fix (locally) I changed import JsonObj, as_json_object to import JsonObj, as_json_obj.

And I had to changes call to as_json_object to as_json_obj

However, this now causes and error with rdflib.graph() because the variable jsonld is a dict:
TypeError: a bytes-like object is required, not 'dict'

To fix this, I used json.dumps() to convert the jsonld dict into a json string:

Another error ....
Cell magic %%yaml --loader DupCheckYamlLoader yaml to work I had to remove the --loader DupCheckYamlLoader yaml

I also get this strange error Javascript Error: require is not defined:

can we close this?
I don't know. Do the errors occur when running the new linkml? I'd have to run the notebook to find out ...
Cataloging errors as I attempt to run examples.ipynb.
Setup before running:
- created a virtual environment:
python -m venv .env - installed both the
requirements.txtand requirements-dev.txtfiles usingpip`.
I get the error: ModuleNotFoundError: No module named 'linkml.dumpers'

dumpers have moved to linkml-runtime. I'd forgotten that we'd turned off the notebooks test case, so apologies for missing this. Will turn it back on (for some reason I can't get it to work in the github actions...) and update and submit the changes.
Thanks for catching this!
Can this be closed?
no, the notebook needs fixed, and more broadly we need a strategy for notebooks. Either get rid of them or commit to keeping them complete and informative, use papermill + CI to check
Are we keeping the notebooks?