Open codam opened 5 years ago
Chris' Email
Hi Raphael,
Élie asked that I give you some information about where some code is and get you oriented with an initial task:
produce a patch from two different versions of a model
The code base you should start w/ is the blmp-prototype-flow repo - which you may have already cloned. Please consult with Nicolas as needed to understand the structure of the repo and libraries and such specific to RDF linked data and so on that will likely be new to you.
There are RDF javascript libraries that will be of use.
There is java code for the basic patch format located in rdf-patch sub-module of rdf-delta so that you can begin to create an rdf-patch.js library. Within the rdf-patch sub-module, the java/org/seaborne/patch contains classes to read RDFPatches and RDFChangesWriter that may be useful entry points. Marc is working in this code and may have additional suggestions about other classes that will be useful in building a basic rdf-patch.js.
Just to help get you started with working with RDF in this sort of situation, consider computing a patch for the difference between two models, let’s suppose the two models are currentM and newM. Assuming operations similar to jena in the rdf js libs. then one can compute
inCommon = currentM.intersection(newM)
to get the unchanged triples. Then
addedM = newM.remove(inCommon)
will be the triples added in newM, and
goneM = currentM.remove(inCommon)
are the triples deleted from currentM in the newM. The the patch consists of a sequence of D subj prop obj graph for each triple in goneM and a sequence of A subj prop obj graph for each triple in addedM. The order of the A’s and D’s in this case is immaterial.
Email with Ruben Verborgh, one of the main contributors of rdf.js
Raphael: Do you know if you know about any RDF Patch javascript library?
Ruben: I don’t know any implementations of that. rdflib.js does SPARQL UPDATE patches as well as Notation3 patches. Should straightforward to convert the format you sent into a SPARQL update though.
rdflib.js supports other kind of patches though; I have written some code with it. The method you need is applyPatch; example at https://github.com/solid/node-solid-server/blob/master/lib/handlers/patch.js
Chat with Elie