HomeSoftware Heritage

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

Description

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).
  1. Remove the need for the hacky merge_values() function (and possibly merge_documents() in a future commit)
  1. 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
  1. Code is longer
  1. Extra dependency (which we will need at some point if we want to import from RDF datasets, anyway)

Details

Provenance
vlorentzAuthored on Aug 22 2022, 2:20 PM
vlorentzPushed on Aug 23 2022, 11:28 AM
Differential Revision
D8279: Refactor metadata mappings using rdflib.Graph instead of JSON-LD internally
Parents
rDCIDX97f5fdcdcc3a: Remove 'keywords' from test files
Branches
Unknown
Tags
Unknown
Build Status
Buildable 30983
Build 48461: test-and-buildJenkins console · Jenkins