Skip to content

Conversation

@gouttegd
Copy link
Contributor

This PR implements option ”A” mentioned in #628. That is, it replaces the LinkML-based code for serialising/deserialising to/from RDF by a completely custom code that implements the new SSSOM/RDF spec exactly as we want it.

All the new code is contained within the new sssom.rdf_internal module, which as the name implies is not really supposed to be used outside of SSSOM-Py (though of course people can still do whatever they want!). The public interface to read from RDF is still the from_sssom_rdf method in sssom.parsers, and the public interface to write to RDF is still the to_rdf_graph method in sssom.writers. Both methods are rewritten to use the MappingSetRDFConverter class of the sssom.rdf_internal module, instead of methods from the LinkML runtime.

closes #628

Since the normalised variant of SSSOM/RDF does not match the output
produced (respectively expected) by the LinkML runtime's dumper (resp.
loader), we implement our own serialisation/deserialisation routines for
RDF.

All the code for RDF import/export is contained within the
sssom.rdf_internal module. The only class expected to be used outside of
that module is the MappingSetRDFConverter class.

The `from_sssom_rdf` and `to_rdf_graph` functions in the sssom.parsers
and sssom.writers modules are rewritten to use that class.
The new RDF converter revealed several issues with our existing tests,
which are fixed here.

* test_convert.py (test_to_rdf_hydrated): That test used an incorrect
  "NOT" value for a predicate modifier slot (the correct value is "Not",
  and there is nothing in the spec to suggest it is case-insensitive);
  it also forgot to declare some prefixes;

* test_writers.py (test_rdflib_endpoint): That test used
  "sssom:MappingCuration" as a column name in a MappingSetDataFrame,
  instead of the expected "mapping_justification"; it also forgot to
  declare some prefixes.
Add a couple of tests to check the behaviour of the new RDF parser.
Also fix an issue (revealed by one of those tests) with the RECORD_ID
slot, which must be compressed upon parsing since it is an
EntityReference-typed slot.
Use the latest pre-release of the SSSOM schema, which includes the
changes related to the latest draft of the SSSOM/RDF specification.
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

Successfully merging this pull request may close these issues.

Support for “new” RDF serialisation

1 participant