Open lukas-koschmieder opened 2 years ago
Hi Lukas. Yes, the intention is to run the horizontal demo based on the ontology generated by the vertical demo. When testing it, I am able to reproduce the same errors as you see. These demos were created during in the CSA project which ended in 2019 and clearly need an update.
Hej Jesper (@jesper-friis ) I have same issue with a small - self-generated ontology (just adding some classes into a newly generated ontology, like in the vertical demo) . When I try to import my exported ontology (oso_mesurement-v0.0.1.owl), like:
from ontopy import get_ontology
onto = get_ontology('oso_mesurement-v0.0.1.owl')
onto.load()
I get a similar error (s.below). Shall I open a new issue for that, since it is not directly related to the vertical demo ?
lib/python3.10/site-packages/ontopy/ontology.py:587: UserWarning: Recovering from Owlready2 parsing error... might be deprecated
warnings.warn(
Output exceeds the [size limit](command:workbench.action.openSettings?[). Open the full output data [in a text editor](command:workbench.action.openLargeOutput?5578c98f-ebe8-42fd-b088-959533a21acc)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File ~/py3venv/lara/lib/python3.10/site-packages/owlready2/driver.py:154, in BaseSubGraph.parse(self, f, format, delete_existing_triples, default_base)
153 if not line.endswith("\n"): line = "%s\n" % line
--> 154 s,p,o = splitter.split(line[:-3], 2)
156 if s.startswith("<"): s = s[1:-1]
ValueError: not enough values to unpack (expected 3, got 2)
The above exception was the direct cause of the following exception:
OwlReadyOntologyParsingError Traceback (most recent call last)
File ~/py3venv/lara/lib/python3.10/site-packages/ontopy/ontology.py:562, in Ontology._load(self, only_local, filename, format, reload, reload_if_newer, url_from_catalog, catalog_file, **kwargs)
561 elif resolved_url.startswith(web_protocol):
--> 562 return super().load(
563 only_local=only_local,
564 reload=reload,
565 reload_if_newer=reload_if_newer,
566 **kwargs,
567 )
569 else:
File ~/py3venv/lara/lib/python3.10/site-packages/owlready2/namespace.py:955, in Ontology.load(self, only_local, fileobj, reload, reload_if_newer, url, **args)
954 try:
--> 955 new_base_iri = self.graph.parse(fileobj, default_base = self.base_iri, **args)
...
125 except KeyError:
--> 126 raise PluginException("No plugin registered for (%s, %s)" % (name, kind))
127 return p.getClass()
PluginException: No plugin registered for (text/plain, <class 'rdflib.parser.Parser'>)
@markdoerr, you might have to provide a format
argument to load()
. Since the file extension is .owl, EMMontoPy assumes by default rdf/xml format.
Tak, @jesper-friis , for the hint - the current default format of ontopy.onotogy.load() is set to 'None' . Maybe one should write a few words about the formats in the ontopy documentation ? A few days ago, I installed EMMOntoPy on a new machine and am working now with turtle flies, like you do in your domain-atomistic ontology and everything is magically working (though the interface to ontopy or owlready2 is quite brittle - I have a lot of trouble there). I did not have to specify the format in load(), if I work with turtle/ttl files. @lukas-koschmieder : for a working example, see https://gitlab.com/opensourcelab/scientificdata/ontologies/openscienceontology/measurements
I'm trying to reproduce the horizontal example on my computer.
Where do I find the ontology (
../vertical/usercase_ontology.owl
) referenced in the very first step?https://github.com/emmo-repo/EMMO-python/blob/b8e2d1017dc795e1788ff9548192e09f50ca5472/demo/horizontal/step1_generate_metadata.py#L29
There is no such file nowhere in the repository. Am I supposed to use
../vertical/demo.owl
instead (the result of the vertical example)? Am asking because if I do use it, step1_generate_metadata.py produces the following error.