Class: sparqlbuilder

mljs# sparqlbuilder

new sparqlbuilder()

IN DEVELOPMENT - A SparqlBuilder object for easy (and performant) sparql creation.

var b = db.createSparqlBuilder() b.subject("JointCustomer").with( b.subject("NKBCustomer").with( b.subject("NKBAccount").has("balance", "<", 100).has("nkbaccountid") ), b.subject("NICClient").with( b.subject("MLDocument").has("docuri") ).has("nicclientid") ); var sparql = b.toSparql();

This would generate (using short form of IRIs for readability):-

SELECT DISTINCT ?subject WHERE { ?subject rdf:type <JointCustomer> . ?subject ?pred1 ?nkbcustomer1 . ?nkbcustomer1 rdf:type <NKBCustomer> . ?nkbcustomer1 ?pred2 ?nkbaccount2 . ?nkbaccount2 rdf:type <NKBAccount> . ?nkbaccount2 ?balance ?value3 . FILTER (?balance < "100"^^<xs:integer>) . ?subject ?pred4 ?nicclient4 . ?nicclient4 rdf:type <NICClient> . ?nicclient4 ?pred5 ?mldocument5 . ?mldocument5 rdf:type <MLDocument> . ?mldocument5 ?pred6 ?docuri . ?nicclient4 ?pred7 ?nicclientid }

Source:

Methods

<static> subject()

Generates a subject with the specified rdf type IRI

TODO complete this method

Source:

has()

Includes the specified predicate IRI from the parent subject object

TODO complete method

Source:

toSparql()

Returns the sparql generated

TODO complete method

Source:

with()

Includes the specified dependant (target of a relationship) Subject

TODO complete this method, and include predicate specification (optional)

Source:
MLJS - A JavaScript wrapper for the MarkLogic REST API
MarkLogic 2012-2014
Documentation generated by JSDoc 3.2.3-dev on Mon Jul 18 2016 09:14:13 GMT+0100 (BST) using the DocStrap template.