Skip to content
Jim Amsden edited this page Feb 21, 2018 · 1 revision

LDP needs persistence services for minimally LDPCs and LDPRs. There are various approaches, technologies and DBMS products that could be used, each of which has its advantages and disadvantages. Here’s a brief list:

  • Jena TDB: already used in many projects, open source, directly supports RDF and SPARQL, but has some scalability and performance issues
  • 4store, 5store, Virtuoso: existing RDF triple stores, but are either out of service, or commercial products that are not suitable for use in open source projects
  • GraphDB - ontotext semantic graph database supporting RDF and SPARQL, commercial product, but has a free edition.
  • JanusGraph: May provide a more scaleable solution
  • MongoDB: popular BSON based document store, but no SPARQL, is one of the current implementations of the ldp-service

See the ldp-service Wiki, [Persistence]## and Which RDF Store To Use for further details.

Since none of these are ideal choices for different reasons, and since the technologies around NoSQL databases are shifting from RDF to JSON, to graph databases, it might be useful to create a Adapter or Facade that abstracts the persistence needs of LDP into an API that could be implemented on any number of different DBMS technologies, perhaps providing different query services.

This adapter should be developed as an Express middleware component used by the ldp-service so that different routes can be used to route requests to different DBMS implementations in the same server. This would allow a single server to federate multiple data sources implemented with different persistence strategies.

The same adapter could then be implemented on other data sources to provide LDP and OSLC access without having to know the details of LDP or OSLC. The iot-service could for example use this approach.

JavaScript Namespaces

Here's a simple pattern to support JavaScript "namespaces".

// extend the functions of anObject, injects elements of a namespace to a context
var anObject = {} // or use this
…
// @namespace someNamespace
(function (exports) {
     var someLib = {
     	x: function() {}
	    }
      exports.someLib = someLib
})(anObject)

anObject will now have function anObject.someLib.x().

Facade

Here's a way to implement the facade pattern in JavaScript"

ldpDB.js
/** @namespace ldpDB */
(function (exports, depInj) {
	   "use strict"
     var constants = Object.freeze({name: value})
	    var ldpDB = {
		create: function(resource, template) {throw "unimplemented" },
     	read: function(uri) {throw "unimplemented" },
     	write = function(resource) {throw "unimplemented" },
     	exports.delete = function(uri) {throw "unimplemented" },
	    	exports.query = function(queryString) {throw "unimplemented" }
    }
	   exports.constants = constants
    exports.ldpDB = ldpDB
})(anObject, dep)

anObject will now have function anObject.ldpDB.create(), etc. with the dep dependency injected into the implementation.

ldpMongoDB.js

Clone this wiki locally