forked from rdf-ext/sparql-http-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseClient.js
More file actions
26 lines (25 loc) · 1 KB
/
BaseClient.js
File metadata and controls
26 lines (25 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* An abstract base client which connects the query, store and endpoint together
*
* Store and Query parameters are both optional and only necessary when the client will connect to SPARQL Graph Store
* or SPARQL Query endpoints respectively
*
* @class
*/
class BaseClient {
/**
* @param {Object} init
* @param {Endpoint} init.endpoint object to connect to SPARQL endpoint
* @param {Query} [init.Query] SPARQL Query/Update executor constructor
* @param {Store} [init.Store] SPARQL Graph Store connector constructor
* @param {factory} [init.factory] RDF/JS DataFactory
* @param {{...(key:value)}} [init.options] any additional arguments passed to Query and Store constructors
*/
constructor ({ endpoint, Query, Store, factory, ...options }) {
/** @member {RawQuery} */
this.query = Query ? new Query({ endpoint, factory, ...options }) : null
/** @member {StreamStore} */
this.store = Store ? new Store({ endpoint, factory, ...options }) : null
}
}
module.exports = BaseClient