RDF Store that uses a local store or a remote store depending on the IRI
npm install rdf-store-serverRDF Store that uses a local store or a remote store depending on the IRI.
It follows the RDF-ext Interface specification.
```
npm install --save rdf-store-server
You will have to specify a local and a remote store in the options.host
The way you can set up the is in the contructor options - this will be set for all method call, or if you want to set the host dynamically at every call, set host in your call options.
If the host (see the example) matches the IRI of the request,local
it means that the file can be accessed by the store, the remote will be used otherwise.
`javascript
var rdf = require('rdf-ext')
var LdpStore = require('rdf-store-ldp')
var FileStore = require('rdf-store-fs')
var ServerStore = require('rdf-store-server')
var http = require('express')
var store = new ServerStore({
local: new LdpStore(rdf),
remote: new FileStore(rdf)
})
var app = express()
app.get('/*', function(req, res) {
var host = req.protocol + '://' + req.host
store.graph(host + req.originalUrl, function (graph, err) {
// This will run on the local store (FileStore)
}, {host: host})
store.graph('http://other.tld/resource.tld', function (graph, err) {
// This will run on the remote store (LdpStore)
}, {host: host})
})
``
Originally made by Nicola Greco
MIT