public interface GraphManager
A manager for CRUD operations on semantic graphs which reside in MarkLogic Server.
For example:
If you have a file called "example.nt" containing one triple in turtle mimetype:
<http://example.org/subject1> <http://example.org/predicate1> <http://example.org/object1> .
You could write it to the database in a graph called "myExample/graphUri" like so:
GraphManager graphMgr = databaseClient.newGraphManager(); FileHandle fileHandle = new FileHandle(new File("example.nt")).withMimetype(RDFMimeTypes.NTRIPLES); graphMgr.write("myExample/graphUri", fileHandle);
Then you could add another triple to the graph like so:
StringHandle stringHandle = new StringHandle() .with("<http://example.org/subject2> <http://example.org/predicate2> <http://example.org/object2> .") .withMimetype(RDFMimeTypes.NTRIPLES); graphMgr.merge("myExample/graphUri", stringHandle);
Then you read the graph from the database into turtle syntax into a variable "triples" like so:
String triples = graphMgr.read("myExample/graphUri", new StringHandle().withMimetype(RDFMimeTypes.NTRIPLES)).get();
You could simplify these examples if you first set the default mimetype so you don't have to call setMimetype on each handle. That also enables you to use the *As convenience methods:
graphMgr.setDefaultMimetype(RDFMimeTypes.NTRIPLES); String triples = graphMgr.readAs("myExample/graphUri", String.class);
If you need to limit access to a graph you can set the permissions:
graphMgr.writePermissions("myExample/graphUri", graphMgr.permission("example_manager", Capability.READ) .permission("example_manager", Capability.UPDATE));
Permissions can also be added with mergePermissions
, deleted with deletePermissions
, or set with calls to write
or merge
to a graph by providing the
permissions argument.
Each new instance of GraphManager is created by DatabaseClient.newGraphManager()
. While these examples use FileHandle and
StringHandle, any TriplesWriteHandle may be used, including custom handles.
While JSONWriteHandle
s will need to use RDFMimeTypes.RDFJSON
mimetype, and XMLWriteHandle
s will need to use RDFMimeTypes.RDFXML
mimetype, most TriplesWriteHandle
s can write
any text mimteypt and can therefore write triples using any of the
RDFMimeTypes.
GraphManager is thread-safe other than setDefaultMimetype
. In other words the only state maintained by an instance
is the default mimetype. Common usage is to call setDefaultMimetype only
once then use the instance across many threads. If you intend to call
setDefaultMimetype from multiple threads, create a new GraphManager for each
thread.
For details about RDF, SPARQL, and semantics in MarkLogic see Semantics Developer's Guide
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_GRAPH
Use with any GraphManager method in place of the uri to work against
the default graph.
|
Modifier and Type | Method and Description |
---|---|
void |
delete(java.lang.String uri)
Permanently delete the specified graph from the server.
|
void |
delete(java.lang.String uri,
Transaction transaction)
Permanently delete the specified graph from the server.
|
void |
deleteGraphs()
Permanently delete all quads from all graphs.
|
void |
deleteGraphs(Transaction transaction)
Permanently delete all quads from all graphs.
|
void |
deletePermissions(java.lang.String uri)
Delete all permissions for the graph.
|
void |
deletePermissions(java.lang.String uri,
Transaction transaction)
Delete all permissions for the graph.
|
java.lang.String |
getDefaultMimetype()
Get the mimetype set by calling setDefaultMimetype.
|
GraphPermissions |
getPermissions(java.lang.String uri)
Retrieve permissions for a graph.
|
GraphPermissions |
getPermissions(java.lang.String uri,
Transaction transaction)
Retrieve permissions for a graph.
|
java.util.Iterator<java.lang.String> |
listGraphUris()
Get the uri for available graphs.
|
void |
merge(java.lang.String uri,
TriplesWriteHandle handle)
Add triples from the handle to the specified graph.
|
void |
merge(java.lang.String uri,
TriplesWriteHandle handle,
GraphPermissions permissions)
Add triples from the handle and add specified permissions to the
specified graph.
|
void |
merge(java.lang.String uri,
TriplesWriteHandle handle,
GraphPermissions permissions,
Transaction transaction)
Add triples from the handle and add specified permissions to the
specified graph.
|
void |
merge(java.lang.String uri,
TriplesWriteHandle handle,
Transaction transaction)
Add triples from the handle to the specified graph.
|
void |
mergeAs(java.lang.String uri,
java.lang.Object graphData)
Add triples from the graphData object to the specified graph.
|
void |
mergeAs(java.lang.String uri,
java.lang.Object graphData,
GraphPermissions permissions)
Add triples from the graphData object and add specified permissions
to the specified graph.
|
void |
mergeAs(java.lang.String uri,
java.lang.Object graphData,
GraphPermissions permissions,
Transaction transaction)
Add triples from the graphData object and add specified permissions
to the specified graph.
|
void |
mergeAs(java.lang.String uri,
java.lang.Object graphData,
Transaction transaction)
Add triples from the graphData object to the specified graph.
|
void |
mergeGraphs(QuadsWriteHandle handle)
Add quads from the handle to the graphs specified in the quads data.
|
void |
mergeGraphs(QuadsWriteHandle handle,
Transaction transaction)
Add quads from the handle to the graphs specified in the quads data.
|
void |
mergeGraphsAs(java.lang.Object quadsData)
Add quads from the object to the graphs specified in the quads data.
|
void |
mergeGraphsAs(java.lang.Object quadsData,
Transaction transaction)
Add quads from the object to the graphs specified in the quads data.
|
void |
mergePermissions(java.lang.String uri,
GraphPermissions permissions)
Add to permissions on the graph.
|
void |
mergePermissions(java.lang.String uri,
GraphPermissions permissions,
Transaction transaction)
Add to permissions on the graph.
|
GraphPermissions |
newGraphPermissions()
Get an empty GraphPermissions instance.
|
GraphPermissions |
permission(java.lang.String role,
Capability... capabilities)
Create a GraphPermissions builder object with the specified role and capabilities.
|
<T extends TriplesReadHandle> |
read(java.lang.String uri,
T handle)
Read triples from the server.
|
<T extends TriplesReadHandle> |
read(java.lang.String uri,
T handle,
Transaction transaction)
Read triples from the server.
|
<T> T |
readAs(java.lang.String uri,
java.lang.Class<T> as)
Read triples from the server as the specified type.
|
<T> T |
readAs(java.lang.String uri,
java.lang.Class<T> as,
Transaction transaction)
Read triples from the server as the specified type.
|
void |
replaceGraphs(QuadsWriteHandle handle)
Remove all quads from all graphs then insert quads from the handle
to the graphs specified in the quads data.
|
void |
replaceGraphs(QuadsWriteHandle handle,
Transaction transaction)
Remove all quads from all graphs then insert quads from the handle
to the graphs specified in the quads data.
|
void |
replaceGraphsAs(java.lang.Object quadsData)
Remove all quads from all graphs then insert quads from the quadsData
to the graphs specified in the quads data.
|
void |
replaceGraphsAs(java.lang.Object quadsData,
Transaction transaction)
Remove all quads from all graphs then insert quads from the quadsData
to the graphs specified in the quads data.
|
void |
setDefaultMimetype(java.lang.String mimetype)
Set the default mimetype for data sent by write* or merge* methods
and data serialized by the server in response to calls to read* or
things* methods.
|
<T extends TriplesReadHandle> |
things(T handle,
java.lang.String... iris)
Retrieves all triples related to specified subject or object iris.
|
<T> T |
thingsAs(java.lang.Class<T> as,
java.lang.String... iris)
Retrieves all triples related to specified subject or object iris.
|
void |
write(java.lang.String uri,
TriplesWriteHandle handle)
Overwrite triples from the handle as the
specified graph.
|
void |
write(java.lang.String uri,
TriplesWriteHandle handle,
GraphPermissions permissions)
Overwrite triples from the handle and specified permissions as the
specified graph.
|
void |
write(java.lang.String uri,
TriplesWriteHandle handle,
GraphPermissions permissions,
Transaction transaction)
Overwrite triples from the handle and specified permissions as the
specified graph.
|
void |
write(java.lang.String uri,
TriplesWriteHandle handle,
Transaction transaction)
Overwrite triples from the handle as the
specified graph.
|
void |
writeAs(java.lang.String uri,
java.lang.Object graphData)
Overwrite triples from the graphData object as the specified graph.
|
void |
writeAs(java.lang.String uri,
java.lang.Object graphData,
GraphPermissions permissions)
Overwrite triples from the graphData object and specified
permissions as the specified graph.
|
void |
writeAs(java.lang.String uri,
java.lang.Object graphData,
GraphPermissions permissions,
Transaction transaction)
Overwrite triples from the graphData object and specified
permissions as the specified graph.
|
void |
writeAs(java.lang.String uri,
java.lang.Object graphData,
Transaction transaction)
Overwrite triples from the graphData object as the specified graph.
|
void |
writePermissions(java.lang.String uri,
GraphPermissions permissions)
Overwrite all permissions for the graph.
|
void |
writePermissions(java.lang.String uri,
GraphPermissions permissions,
Transaction transaction)
Overwrite all permissions for the graph.
|
static final java.lang.String DEFAULT_GRAPH
Use with any GraphManager method in place of the uri to work against the default graph. The string value is not important and for java-client internal use only--it is never sent to the database.
Example:
StringHandle stringHandle = new StringHandle() .with("<http://example.org/subject2> <http://example.org/predicate2> <http://example.org/object2> .") .withMimetype(RDFMimeTypes.NTRIPLES); graphMgr.merge(DEFAULT_GRAPH, stringHandle);
java.util.Iterator<java.lang.String> listGraphUris()
Get the uri for available graphs.
Example:
Iterator<String> iter = graphMgr.listGraphUris(); while ( iter.hasNext() ) { String uri = iter.next(); ... }
<T extends TriplesReadHandle> T read(java.lang.String uri, T handle) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Read triples from the server. The server can serialize the triples
using any RDFMimeTypes except TRIG. Specify the desired serialization
mimetype by calling setDefaultMimetype
or
handle.setMimetype
or withMimetype (if
available) on your handle.
T
- the type of TriplesReadHandle to returnuri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle to populate and return, set with the desired
mimetype from RDFMimeTypesResourceNotFoundException
ForbiddenUserException
FailedRequestException
example usage in class javadoc
<T extends TriplesReadHandle> T read(java.lang.String uri, T handle, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Read triples from the server. The server can serialize the triples
using any RDFMimeTypes except TRIG. Specify the desired serialization
mimetype by calling setDefaultMimetype
or
handle.setMimetype
or withMimetype (if
available) on your handle.
T
- the type of TriplesReadHandle to returnuri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle to populate and return with the desired
mimetype from RDFMimeTypes
mimetype from RDFMimeTypestransaction
- the open transaction to read fromResourceNotFoundException
ForbiddenUserException
FailedRequestException
<T> T readAs(java.lang.String uri, java.lang.Class<T> as) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Read triples from the server as the specified type. The server can
serialize the triples using any RDFMimeTypes except TRIG. Specify the
desired serialization using setDefaultMimetype
.
T
- the type of object that will be returned by the handle registered for ituri
- the graph uri or DEFAULT_GRAPH
constantas
- the type to populate and return. This type must be registered by an io handle.ResourceNotFoundException
ForbiddenUserException
FailedRequestException
example usage in class javadoc
<T> T readAs(java.lang.String uri, java.lang.Class<T> as, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Read triples from the server as the specified type. The server can
serialize the triples using any RDFMimeTypes except TRIG. Specify the
desired serialization using setDefaultMimetype
.
T
- the type of object that will be returned by the handle registered for ituri
- the graph uri or DEFAULT_GRAPH
constantas
- the type to populate and return. This type must be registered by an io handle.transaction
- the open transaction to read fromResourceNotFoundException
ForbiddenUserException
FailedRequestException
GraphPermissions getPermissions(java.lang.String uri) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Retrieve permissions for a graph.
uri
- the graph uri or DEFAULT_GRAPH
constantResourceNotFoundException
ForbiddenUserException
FailedRequestException
GraphPermissions getPermissions(java.lang.String uri, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Retrieve permissions for a graph.
uri
- the graph uri or DEFAULT_GRAPH
constanttransaction
- the open transaction to read fromResourceNotFoundException
ForbiddenUserException
FailedRequestException
void deletePermissions(java.lang.String uri) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Delete all permissions for the graph.
uri
- the graph uri or DEFAULT_GRAPH
constantResourceNotFoundException
ForbiddenUserException
FailedRequestException
void deletePermissions(java.lang.String uri, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Delete all permissions for the graph.
uri
- the graph uri or DEFAULT_GRAPH
constanttransaction
- the open transaction to delete inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void writePermissions(java.lang.String uri, GraphPermissions permissions) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite all permissions for the graph.
uri
- the graph uri or DEFAULT_GRAPH
constantpermissions
- the permissions to set for this graphResourceNotFoundException
ForbiddenUserException
FailedRequestException
void writePermissions(java.lang.String uri, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite all permissions for the graph.
uri
- the graph uri or DEFAULT_GRAPH
constantpermissions
- the permissions to set for this graphtransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergePermissions(java.lang.String uri, GraphPermissions permissions) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add to permissions on the graph.
uri
- the graph uri or DEFAULT_GRAPH
constantpermissions
- the permissions to add to this graphResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergePermissions(java.lang.String uri, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add to permissions on the graph.
uri
- the graph uri or DEFAULT_GRAPH
constantpermissions
- the permissions to add to this graphtransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
GraphPermissions permission(java.lang.String role, Capability... capabilities)
role
- the name of the role receiving these capabilitiescapabilities
- the capabilities (READ, UPDATE, or EXECUTE) granted to this rolevoid merge(java.lang.String uri, TriplesWriteHandle handle) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the handle to the specified graph. The server can
receive the triples as any of the RDFMimeTypes
. Specify the
mimetype appropriate for your content by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypesResourceNotFoundException
ForbiddenUserException
FailedRequestException
example usage in class javadoc
void merge(java.lang.String uri, TriplesWriteHandle handle, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the handle to the specified graph. The server can
receive the triples as any of the RDFMimeTypes
. Specify the
mimetype appropriate for your content by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypestransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void merge(java.lang.String uri, TriplesWriteHandle handle, GraphPermissions permissions) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the handle and add specified permissions to the
specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if
available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypespermissions
- the permissions to add to this graphResourceNotFoundException
ForbiddenUserException
FailedRequestException
void merge(java.lang.String uri, TriplesWriteHandle handle, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the handle and add specified permissions to the
specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if
available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypespermissions
- the permissions to add to this graphtransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeAs(java.lang.String uri, java.lang.Object graphData) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the graphData object to the specified graph. The
server can receive the triples as any of the RDFMimeTypes
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of appropriate RDFMimeTypesMimetype}ResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeAs(java.lang.String uri, java.lang.Object graphData, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the graphData object to the specified graph. The
server can receive the triples as any of the RDFMimeTypes
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
transaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeAs(java.lang.String uri, java.lang.Object graphData, GraphPermissions permissions) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the graphData object and add specified permissions
to the specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
permissions
- the permissions to add to this graphResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeAs(java.lang.String uri, java.lang.Object graphData, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add triples from the graphData object and add specified permissions
to the specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
permissions
- the permissions to add to this graphtransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void write(java.lang.String uri, TriplesWriteHandle handle) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the handle as the
specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypesResourceNotFoundException
ForbiddenUserException
FailedRequestException
example usage in class javadoc
void write(java.lang.String uri, TriplesWriteHandle handle, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the handle as the
specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypestransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void write(java.lang.String uri, TriplesWriteHandle handle, GraphPermissions permissions) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the handle and specified permissions as the
specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypespermissions
- the permissions to ovewrite for this graphResourceNotFoundException
ForbiddenUserException
FailedRequestException
example usage in class javadoc
void write(java.lang.String uri, TriplesWriteHandle handle, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the handle and specified permissions as the
specified graph. The server can receive the triples as any of the
RDFMimeTypes
. Specify the mimetype appropriate for your content
by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
uri
- the graph uri or DEFAULT_GRAPH
constanthandle
- the handle containing triples of appropriate RDFMimeTypespermissions
- the permissions to ovewrite for this graphtransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void writeAs(java.lang.String uri, java.lang.Object graphData) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the graphData object as the specified graph.
The server can receive the triples as any of the RDFMimeTypes
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
ResourceNotFoundException
ForbiddenUserException
FailedRequestException
void writeAs(java.lang.String uri, java.lang.Object graphData, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the graphData object as the specified graph.
The server can receive the triples as any of the RDFMimeTypes
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
transaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void writeAs(java.lang.String uri, java.lang.Object graphData, GraphPermissions permissions) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the graphData object and specified
permissions as the specified graph. The server can receive the triples
as any of the RDFMimeTypes
. Specify the mimetype appropriate
for your content by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
permissions
- the permissions to ovewrite for this graphResourceNotFoundException
ForbiddenUserException
FailedRequestException
void writeAs(java.lang.String uri, java.lang.Object graphData, GraphPermissions permissions, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Overwrite triples from the graphData object and specified
permissions as the specified graph. The server can receive the triples
as any of the RDFMimeTypes
. Specify the mimetype appropriate
for your content by calling setDefaultMimetype
.
uri
- the graph uri or DEFAULT_GRAPH
constantgraphData
- the object containing triples of RDFMimeTypes specified by
setDefaultMimetype
permissions
- the permissions to ovewrite for this graphtransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void delete(java.lang.String uri) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Permanently delete the specified graph from the server.
uri
- the graph uri or DEFAULT_GRAPH
constantResourceNotFoundException
ForbiddenUserException
FailedRequestException
void delete(java.lang.String uri, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Permanently delete the specified graph from the server.
uri
- the graph uri or DEFAULT_GRAPH
constanttransaction
- the open transaction to delete inResourceNotFoundException
ForbiddenUserException
FailedRequestException
<T extends TriplesReadHandle> T things(T handle, java.lang.String... iris) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Retrieves all triples related to specified subject or object iris.
The server can serialize the triples using any RDFMimeTypes except TRIG.
Specify the desired serialization mimetype by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
T
- the type of TriplesReadHandle to returnhandle
- the handle to populate and return with the desired
mimetype from RDFMimeTypesiris
- the subject or object iris to retrieveResourceNotFoundException
ForbiddenUserException
FailedRequestException
<T> T thingsAs(java.lang.Class<T> as, java.lang.String... iris) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Retrieves all triples related to specified subject or object iris. The server can
serialize the triples using any RDFMimeTypes except TRIG. Specify the
desired serialization using setDefaultMimetype
.
T
- the type of object that will be returned by the handle registered for itas
- the type to populate and return. This type must be registered by an io handle.iris
- the subject or object iris to retrieveResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeGraphs(QuadsWriteHandle handle) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add quads from the handle to the graphs specified in the quads data.
The server can receive the quads as RDFMimeTypes.NQUADS
or
RDFMimeTypes.TRIG
. Specify the mimetype appropriate for your
content by calling setDefaultMimetype
or
handle.setMimetype
or withMimetype (if
available) on your handle.
handle
- the handle containing quads of appropriate RDFMimeTypesResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeGraphs(QuadsWriteHandle handle, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add quads from the handle to the graphs specified in the quads data.
The server can receive the quads as RDFMimeTypes.NQUADS
or
RDFMimeTypes.TRIG
. Specify the mimetype appropriate for your
content by calling setDefaultMimetype
or
handle.setMimetype
or withMimetype (if
available) on your handle.
handle
- the handle containing quads of appropriate RDFMimeTypestransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeGraphsAs(java.lang.Object quadsData) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add quads from the object to the graphs specified in the quads data.
The server can receive the quads as RDFMimeTypes.NQUADS
or
RDFMimeTypes.TRIG
. Specify the mimetype appropriate for your
content by calling setDefaultMimetype
.
quadsData
- the object containing quads of RDFMimeTypes specified by
setDefaultMimetype
ResourceNotFoundException
ForbiddenUserException
FailedRequestException
void mergeGraphsAs(java.lang.Object quadsData, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Add quads from the object to the graphs specified in the quads data.
The server can receive the quads as RDFMimeTypes.NQUADS
or
RDFMimeTypes.TRIG
. Specify the mimetype appropriate for your
content by calling setDefaultMimetype
.
quadsData
- the object containing quads of RDFMimeTypes specified by
setDefaultMimetype
transaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void replaceGraphs(QuadsWriteHandle handle) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Remove all quads from all graphs then insert quads from the handle
to the graphs specified in the quads data. The server can receive the
quads as RDFMimeTypes.NQUADS
or RDFMimeTypes.TRIG
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
handle
- the handle containing quads of appropriate RDFMimeTypesResourceNotFoundException
ForbiddenUserException
FailedRequestException
void replaceGraphs(QuadsWriteHandle handle, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Remove all quads from all graphs then insert quads from the handle
to the graphs specified in the quads data. The server can receive the
quads as RDFMimeTypes.NQUADS
or RDFMimeTypes.TRIG
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
or handle.setMimetype
or withMimetype (if available) on your handle.
handle
- the handle containing quads of appropriate RDFMimeTypestransaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void replaceGraphsAs(java.lang.Object quadsData) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Remove all quads from all graphs then insert quads from the quadsData
to the graphs specified in the quads data. The server can receive the
quads as RDFMimeTypes.NQUADS
or RDFMimeTypes.TRIG
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
.
quadsData
- the object containing quads of RDFMimeTypes specified by
setDefaultMimetype
ResourceNotFoundException
ForbiddenUserException
FailedRequestException
void replaceGraphsAs(java.lang.Object quadsData, Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Remove all quads from all graphs then insert quads from the quadsData
to the graphs specified in the quads data. The server can receive the
quads as RDFMimeTypes.NQUADS
or RDFMimeTypes.TRIG
.
Specify the mimetype appropriate for your content by calling setDefaultMimetype
.
quadsData
- the object containing quads of RDFMimeTypes specified by
setDefaultMimetype
transaction
- the open transaction to write inResourceNotFoundException
ForbiddenUserException
FailedRequestException
void deleteGraphs() throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Permanently delete all quads from all graphs.
void deleteGraphs(Transaction transaction) throws ResourceNotFoundException, ForbiddenUserException, FailedRequestException
Permanently delete all quads from all graphs.
transaction
- the open transaction to delete inResourceNotFoundException
ForbiddenUserException
FailedRequestException
java.lang.String getDefaultMimetype()
void setDefaultMimetype(java.lang.String mimetype)
mimetype
- the new default mimetypeGraphPermissions newGraphPermissions()
Copyright © 2013-2018 MarkLogic Corporation.