Search code examples
python-3.xxmlrdfredlandrdf-xml

Comparing two RDF/XML files using Raptor and also generating differences?


I want to write Python script using Raptor to compare two RDF files where the 2nd RDF file would have a a specific format that the 1st one should follow. If there is a difference, then I want to print that difference. No luck with W3...


Solution

  • I can't tell you anything python specific but there are basically two approache:

    • split the graphs into subgraphs so that the blank nodes preserve their contexts and remove isomorphic subgraphs, what's left are the differences
    • serialize the graphs using a deterministic serialization (incl. deterministic blank node labelling) and make a textual diff

    The first approach is mplemented in RDF-Utils which you can get here: https://sourceforge.net/projects/knobot/files/rdf-utils/0.5/