1

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...

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
  • Give some examples of what the file format is, and what you want to do with the files. – funkymushroom Mar 30 '20 at 18:35
  • We can take two xml files and what i want is to check if the both the files follow same format and if not then what is the difference. – Apoorv Kudesia Mar 30 '20 at 18:42
  • An XML file is not RDF .... moreover, why do you want to use Raptor in Python? There are RDF APIs for Python like `rdflib`. And then, what if your data contains blank nodes? This is likely to be an isomorphism problem. Anyways, without showing concrete input data and the expected result, no more help possible. – UninformedUser Mar 31 '20 at 07:20

1 Answers1

1

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/

Reto Gmür
  • 2,497
  • 1
  • 20
  • 25