Namespace: graphs
graphs
Provides functions read, write, merge,
remove, list, or query with SPARQL on triple graphs.
Methods
-
-
createMergeStream(uri, contentType, repair, txid) → {WritableStream}
-
Adds the triples for the specified graph in incremental chunks with a stream; takes the following parameters (but not a data parameter).
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be omitted for the default graph contentType
string the format for the graph such as application/n-quads, application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle, or application/vnd.marklogic.triples+xml repair
boolean <optional>
whether to attempt to repair errors in the graph data txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction in which to merge the triples - Since:
-
- 1.0
Returns:
a stream for writing the triples- Type
- WritableStream
-
-
createWriteStream(uri, contentType, repair, txid) → {WritableStream}
-
Creates or replaces the triples for the specified graph in incremental chunks with a stream; takes the following parameters (but not a data parameter).
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be ommitted for the default graph contentType
string the format for the graph such as application/n-quads, application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle, or application/vnd.marklogic.triples+xml repair
boolean <optional>
whether to attempt to repair errors in the graph data txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction in which to write the triples - Since:
-
- 1.0
Returns:
a stream for writing the triples- Type
- WritableStream
-
-
list(contentType, txid, timestamp) → {ResultProvider}
-
Lists the graphs stored on the server.
Parameters:
Name Type Argument Description contentType
string the format for the list of graphs txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction that has uncommitted triples for new graphs timestamp
DatabaseClient.Timestamp <optional>
a Timestamp object for point-in-time operations. - Since:
-
- 1.0
Returns:
an object whose result() function takes a success callback that receives the list of graphs stored on the server- Type
- ResultProvider
-
-
merge(uri, contentType, repair, permissions, data, txid)
-
Adds the triples for the specified graph.
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be ommitted for the default graph contentType
string the format for the graph such as application/n-quads, application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle, or application/vnd.marklogic.triples+xml repair
boolean <optional>
whether to attempt to repair errors in the graph data permissions
Array.<object> <optional>
the permissions controlling which users can read or write the documents with the triples data
object | string | Buffer | ReadableStream <optional>
the graph data in the specified format txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction in which to merge the triples - Since:
-
- 1.0
-
-
probe(uri, txid) → {ResultProvider}
-
Check whether the specified graph exists.
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be omitted for the default graph txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction that has uncommitted triples - Since:
-
- 1.0
Returns:
an object whose result() function takes a success callback that receives an object with an exists boolean for the graph- Type
- ResultProvider
-
-
read(uri, contentType, category, txid, timestamp) → {ResultProvider}
-
Reads the triples for a graph from the server in the specified format.
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be ommitted for the default graph contentType
string the format for the graph such as application/n-quads, application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle, or application/vnd.marklogic.triples+xml category
string <optional>
a value from the enumeration "content|metadata|permissions" that specifies whether to retrieve the triple content of the graph (the default) or the metadata permissions for the graph documents txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction that has uncommitted triples timestamp
DatabaseClient.Timestamp <optional>
a Timestamp object for point-in-time operations. - Since:
-
- 1.0
Returns:
an object whose stream() function returns a read stream that receives the triples for the graph in the requested format- Type
- ResultProvider
-
-
remove(uri, txid) → {ResultProvider}
-
Removes the specified graph.
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be omitted for the default graph txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction in which to remove the triples - Since:
-
- 1.0
Returns:
an object whose result() function takes a success callback called when the triples are removed- Type
- ResultProvider
-
-
sparql(contentType, defaultGraphs, namedGraphs, query, docQuery, start, length, base, txid, rulesets, defaultRulesets, optimizeLevel, bindings, timestamp) → {ResultProvider}
-
Executes a SPARQL query against the triples for the graphs; takes a configuration object with the following named parameters or, as a shortcut, a contentType string, any number of default graph URIs, and a SPARQL query.
Parameters:
Name Type Argument Description contentType
string the format for the query response defaultGraphs
string | Array.<string> <optional>
the default graphs for the SPARQL query namedGraphs
string | Array.<string> <optional>
the named graphs for the SPARQL query query
string | ReadableStream the SPARQL query docQuery
object <optional>
a queryBuilder.Query returned by the query builder functions that qualifies the documents supplying the triples start
number <optional>
the zero-based position within the results of the first triple, which is determinate only for a SELECT SPARQL query that orders the results and defaults to the first length
number <optional>
the zero-based position of the triple after the last triple, which is determinate only for a SELECT SPARQL query that orders the results and defaults to all triples base
string <optional>
the base URI to prepend to relative resource identifiers txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction that has uncommitted triples rulesets
string | Array.<string> <optional>
the inference rulesets applied to infer additional triples for the query defaultRulesets
string <optional>
a value from the enumeration "include|exclude" to specify whether to apply the default rulesets (if any) to infer additional triples for the query (defaulting to "include") optimizeLevel
number <optional>
the level of effort applied by the SPARQL query analyzer for optimizing the query bindings
object <optional>
the values for placeholder variables within the query specified with an object whose keys are the names of the variables and whose values are either primitives or objects with a type or lang key and a value key timestamp
DatabaseClient.Timestamp <optional>
a Timestamp object for point-in-time operations - Since:
-
- 1.0
Returns:
an object whose stream() function returns a read stream that receives the query response- Type
- ResultProvider
-
-
sparqlUpdate(data, permissions, usingDefaultGraphs, usingNamedGraphs, base, txid, rulesets, defaultRulesets, optimizeLevel, bindings) → {ResultProvider}
-
Executes a SPARQL update against the graphs; takes a configuration object with the following named parameters or, as a shortcut, the SPARQL update data.
Parameters:
Name Type Argument Description data
string | ReadableStream the SPARQL update permissions
Array.<object> <optional>
the permissions controlling which users can read or write the documents with the updated triples usingDefaultGraphs
string | Array.<string> <optional>
the default graphs for the update usingNamedGraphs
string | Array.<string> <optional>
the named graphs for the update base
string <optional>
the base URI to prepend to relative resource identifiers txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction in which to update the triples rulesets
string | Array.<string> <optional>
the inference rulesets applied to infer additional triples as part of the update defaultRulesets
string <optional>
a value from the enumeration "include|exclude" to specify whether to apply the default rulesets (if any) to infer additional triples for the update (defaulting to "include") optimizeLevel
number <optional>
the level of effort applied by the SPARQL query analyzer for optimizing the update bindings
object <optional>
the values for placeholder variables within the update specified with an object whose keys are the names of the variables and whose values are either primitives or objects with a type or lang key and a value key - Since:
-
- 1.0
Returns:
an object whose result() function takes a success callback called when the triples are updated- Type
- ResultProvider
-
-
write(uri, contentType, repair, permissions, data, txid)
-
Creates or replaces the triples for the specified graph.
Parameters:
Name Type Argument Description uri
string <optional>
a graph name, which can be ommitted for the default graph contentType
string the format for the graph such as application/n-quads, application/n-triples, application/rdf+json, application/rdf+xml, text/n3, text/turtle, or application/vnd.marklogic.triples+xml repair
boolean <optional>
whether to attempt to repair errors in the graph data permissions
Array.<object> <optional>
the permissions controlling which users can read or write the documents with the triples data
object | string | Buffer | ReadableStream <optional>
the graph data in the specified format txid
string | transactions.Transaction <optional>
a string transaction id or Transaction object identifying an open multi-statement transaction in which to write the triples - Since:
-
- 1.0