Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop a Javascript RDF Patch library #7

Open
codam opened this issue Jun 11, 2019 · 2 comments
Open

Develop a Javascript RDF Patch library #7

codam opened this issue Jun 11, 2019 · 2 comments

Comments

@codam
Copy link
Contributor

codam commented Jun 11, 2019

Chat with Elie

  • Develop a library using the same API and data model than the RDF JavaScript Libraries which would allow us to create patches
  • independant library, published on npm
  • the idea would be to make it generic so that we could give it to organization behind RDF JavaScript Libraries so that they could take care of its maintenance
  • to handle our specificities, like the "taskid" in the header, we could have a method which handles what needs to be put in the header
  • could be pretty simple using a naive approach
  • its API should be pretty similar than the Java library. Chris knows the code, she will be able to guide me on the most interesting fonctions
@codam
Copy link
Contributor Author

codam commented Jun 11, 2019

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.

@codam
Copy link
Contributor Author

codam commented Jun 11, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant