Skip to content

Support for “new” RDF serialisation #628

@gouttegd

Description

@gouttegd

Now that the normalized form of the RDF serialisation is about to get merged, we should think about how it is going to be supported by SSSOM-Py.

The normalized form is purposefully very close to the form that SSSOM-Py has been producing and reading since the beginning, but it does deviates from it on some aspects – it deviates enough for the current SSSOM/RDF parser in SSSOM-Py to reject a file compliant with the normalized form.

Both the current SSSOM/RDF parser and the current SSSOM/RDF writer in SSSOM-Py are heavily reliant on the LinkML runtime: the parser is mostly a thin wrapper around LinkML’s RDFLibLoader and the writer is mostly a thin wrapper around LinkML’s rdflib_dumper.

Unfortunately, that approach is only valid for a RDF serialisation that is exactly conform to LinkML’s RDF translation rules, which the new normalized form of SSSOM/RDF is not.

Possible new approaches to support the form:

(A) Forget about LinkML’s RDF-related methods and write entirely custom code to convert to and from RDF, using SSSOM’s own translation rules.

In my (not-so-)humble opinion the best solution, simultaneously the cleanest and the most flexible, but possibly the one that will require the most work (though it’s unclear to me that the other approaches below are actually any better on that front).

(B) Keep using the LinkML runtime, with appropriate pre- and post-processing steps. That is:

  • when converting from RDF, add a pre-processing step to transform the graph into the form expected by the LinkML runtime, then feed the transformed graph to the runtime;
  • when converting to RDF, use the LinkML runtime to produce a first graph, then add a post-processing step to transform that graph into the new normalized form.

Possibly quicker to code, but that’s a lot of completely avoidable complexity.

(C) Going through JSON-LD, as suggested in #592 (at least for the conversion to RDF).

The problem here is the JSON-LD serialisation of SSSOM is still not formally defined (which incidentally is also the case of the non-LD JSON serialisation). Now I think it would make much sense for SSSOM/JSON-LD to be defined in such a way that is exactly equivalent to SSSOM/RDF, but we have not decided that yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions