OSLC / ldp-service

Express.js middleware to support an LDP server built on MongoDB
http://oslc.github.io/developing-oslc-applications/oslc-open-source-node-projects.html
Apache License 2.0
14 stars 2 forks source link

Support multiple database implementations using different ldp-service subApp routes #6

Closed jamsden closed 5 years ago

jamsden commented 6 years ago

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.

jamsden commented 6 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.

jamsden commented 6 years ago

Here's how I'm proceeding:

jamsden commented 5 years ago

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.