-
Notifications
You must be signed in to change notification settings - Fork 12
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
Improve testing of round trip serialization #480
Conversation
I am pretty skeptical of this. Can you make a 100% explicit test that shows what is going on here? Loading these opaque files makes it difficult to review this PR |
@cthoyt I have now updated the code to reflect your design in the parse_sssom_table method. As we wont have Harshad for a while, and I will have to deal with maintaining SSSOM for a bit, if you can find a minute to see if what I am doing makes sense, that would be much appreciated. |
This is now covered by the generic test below
@matentzn current issues are now due to data quality with the test data. I can't address further since it's going to require debugging some mismatch between the RDF and the LinkML schema INFO:root:Unmapped predicated: {rdflib.term.URIRef('https://w3id.org/sssom/comment'), rdflib.term.URIRef('https://w3id.org/sssom/creator_id'), rdflib.term.URIRef('https://w3id.org/sssom/license'), rdflib.term.URIRef('https://w3id.org/sssom/mapping_date')}
INFO:root:Triple processed = 2459, unprocessed = 86
Ran 1 test in 6.724s
FAILED (errors=1)
Error
Traceback (most recent call last):
File "/Users/cthoyt/dev/sssom-py/tests/test_parsers.py", line 250, in test_parse_sssom_rdf
msdf = from_sssom_rdf(g=self.rdf_graph, prefix_map=self.df_converter, meta=self.metadata)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cthoyt/dev/sssom-py/src/sssom/parsers.py", line 451, in from_sssom_rdf
RDFLibLoader().load(
File "/Users/cthoyt/.virtualenvs/indra/lib/python3.11/site-packages/linkml_runtime/loaders/rdflib_loader.py", line 256, in load
objs = self.from_rdf_graph(g, schemaview=schemaview, target_class=target_class, prefix_map=prefix_map, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cthoyt/.virtualenvs/indra/lib/python3.11/site-packages/linkml_runtime/loaders/rdflib_loader.py", line 205, in from_rdf_graph
return [target_class(**x) for x in root_dicts]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cthoyt/.virtualenvs/indra/lib/python3.11/site-packages/linkml_runtime/loaders/rdflib_loader.py", line 205, in <listcomp>
return [target_class(**x) for x in root_dicts]
^^^^^^^^^^^^^^^^^
File "<string>", line 31, in __init__
File "/Users/cthoyt/.virtualenvs/indra/lib/python3.11/site-packages/sssom_schema/datamodel/sssom_schema.py", line 110, in __post_init__
self.MissingRequiredField("license")
File "/Users/cthoyt/.virtualenvs/indra/lib/python3.11/site-packages/linkml_runtime/utils/yamlutils.py", line 273, in MissingRequiredField
raise ValueError(f"{field_name} must be supplied")
ValueError: license must be supplied |
this is, indeed, 141, and was wrong before.
@cthoyt thank you for your help on this; I fixed the remaining test and now everything passes. If you don't see any further issue, I think this is ready to go! |
This fixes: mapping-commons/sssom#321
So the issue was when a tsv file is
sssom convert
ed to a JSON file and then the same JSON file issssom parse
d back, there was an error thrown :This happened because the
@context
block of the JSON file which contained the prefix map was never considered while forming theprefix_map
and the metadata items (mapping_set_id
,license
etc) were also ignored. In addition to this, an absence of the external metadata file path param made it get the default metadata and prefix map internally which is a clear bug in the system.This PR resolves that issue.