Loading TOC...

MarkLogic Server 11.0 Product Documentation
DELETE /v1/graphs

Summary

Remove triples in a named graph or the default graph, or remove all graphs from the triple store.

URL Parameters
database? Perform this operation on the named content database instead of the default content database associated with the REST API instance. Using an alternative database requires the "eval-in" privilege; for details, see Security Requirements in the REST Application Developer's Guide.
graph? The URI of a graph to modify. You cannot use this parameter in conjunction with the default parameter.
default? Indicates the request should modify the default graph. You cannot use this parameter in conjunction with the graph parameter.
category? The category of data to delete or reset. Allowed values: content, permissions, metadata. The permissions and metadata values are equivalent. This parameter can only be used with a default or graph parameter.
txid? The transaction identifier of the multi-statement transaction in which to service this request. Use the /transactions service to create and manage multi-statement transactions.

Response

When removing a specific named graph, MarkLogic returns status 204 (Updated) if the delete succeeds; if the target graph does not exist, MarkLogic returns status 404 (Not Found). When removing all graphs or the default graph, MarkLogic returns status 204 (Updated) in all cases.

Required Privileges

This operation requires the rest-writer role, or the following privilege:

http://marklogic.com/xdmp/privileges/rest-writer

Usage Notes

You can use this method in the following ways:

This interface implements the DELETE method of the W3C Graph Store HTTP Protocol when working with a named graph or the default graph; for details, see http://www.w3.org/TR/sparql11-http-rdf-update/.

You can only use this operation to remove managed triples from a graph. You cannot use it to remove unmanaged triples (those embedded in documents). If you attempt to remove a graph that contains both managed and unmanaged triples, the unmanaged triples remain after the request completes. In this case, the graph continues to exist, but the managed triples are removed and the graph permissions are reset.

See Also

Example

$ curl --anyauth --user user:password -i -X DELETE \
    http://localhost:8000/v1/graphs?graph=/my/named/graph

==> All managed triples in the graph with URI "/my/named/graph" are deleted.
    MarkLogic returns headers similar to the following:

HTTP/1.1 204 Updated
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
  

Example

$ curl --anyauth --user user:password -i -X DELETE \
    http://localhost:8000/v1/graphs

==> All managed triples in all graphs are deleted. MarkLogic returns headers 
    similar to the following:

HTTP/1.1 204 Updated
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
  

Example

$ curl --anyauth --user user:password -i -X DELETE \
    'http://localhost:8000/v1/graphs?default&category=permissions'

==> Reset the permissions on the default graph to the default settings.
    The graph contents are unaffected. MarkLogic returns headers similar 
    to the following:

HTTP/1.1 204 Updated
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.