Closed jamsden closed 5 years ago
This is going to be more difficult than originally anticipated. The original LDPjs implementation was developed on MongoDB. A while back we extracted the LDP implementation from that sample app into ldp-service so it is reusable as Express middleware. However, the database implementation (db.js) was still tightly coupled to the MongoDB implementation. Neil and I attempted to extract the db.js code into an abstract storage.js implementation that could be instantiated on multiple different database implementations including Jena, JanusGraph, MongoDB, etc.
Unfortunately, the ldp-service LDP implementation that would be common across all these storage service implementations is tightly coupled to the MongoDB implementation. This is because the internal representation of the triples in ldp-service is based on the JSON representation in the MongoDB implementation.
What we need to do is change the internal representation that ldp-service uses to be rdflib.js IndexedFormula (or a KB). Then when the MongoDB JSON is loaded from the database, we need to put the triples in a KB that represents the resource. This will allow us to use rdflib.js to parse and serialize different RDF serialization formats to support more content types.
Then the turtle.js and json.js serializers that are currently in ldp-service, which are specific to the MongoDB implementation, will no longer be needed.
It sill take some time and testing to do all this, but the result will be worth it: an ldp-service express middleware component that can provide LDP access to multiple RDF serialization formats implemented on multiple persistence platforms.
Here's how I'm proceeding:
[x] Implement all the ldp-service methods on an rdflib.js IndexedFormula.
[x] Implement ldp-service-jena to support storage.js implementation on Jena returning all the IndexFormula instances ldp-service needs.
[x] Test ldp-app with the updated ldp-service
[ ] Implement ldp-service-mongodb to support storage.js implementation on MongoDB returning all the IndexFormula instances ldp-service needs. Not sure this is all that valuable as a deliverable. But would be useful to ensure ldp-service and implementations of storage.js are sufficient to support adapters.
The storage.js data services abstraction is more or less complete, the Jena implementation using Fuseki is complete enough to prove and test the storage abstraction. Implementation of MongoDB storage services is of limited value. So closing this more general issue as completed. Other more specific issues can be raised to cover the remaining details.
The current ldp-service implementation it is hard-coded to instantiate its abstract storage.js using ldp-service-mongodb. This needs to be configured in the env, not hard-coded, or better, through a subApp so that different URLs can be directed at different DB implementations in the same server.