Skip to content

Refactor metadata mappings using rdflib.Graph instead of JSON-LD internally

Motivation:

  1. It makes it easier to visualize what is actually happening when modifying the graph, by working explicitly on triples instead of a JSON-LD (a tree serialization of the graph).
  2. Remove the need for the hacky merge_values() function (and possibly merge_documents() in a future commit)
  3. It also catches malformed data exactly where it is added in the document (the call to rdflib.Graph.add()) instead of at the end of the mapping when running compaction/expansion.

Downsides:

  1. Tests are clunkier, because they relied on deterministic order of unordered lists; but rdflib does not guarantee it
  2. Code is longer
  3. Extra dependency (which we will need at some point if we want to import from RDF datasets, anyway)

Sorry for the big diff. Bulk of changes is in base.py, codemeta.py, and `utils.py, everything else is adaptations of existing code without changing the underlying semantics

Depends on !368 (closed), !371 (closed), and !372 (closed)


Migrated from D8279 (view on Phabricator)

Merge request reports