Class AGHttpRepoClient
- All Implemented Interfaces:
AutoCloseable
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
ConstructorDescriptionAGHttpRepoClient
(AGAbstractRepository repo, AGHTTPClient client, String repoRoot, String sessionRoot) AGHttpRepoClient
(AGAbstractRepository repo, AGHTTPClient client, String repoRoot, String sessionRoot, ScheduledExecutorService executor) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributeDefinition
(String name, List<String> allowedValues, boolean ordered, long minimum, long maximum) HTTP client layer function for requesting that AG define a new attribute.void
Adds the given index to the list of actively managed indices.void
addRules
(InputStream rulestream) void
void
addSessionLoadScript
(String scriptName) Adds a 'script' for a dedicated session spawned by this instance.void
addStatements
(Resource subj, IRI pred, Value obj, Resource... contexts) callStoredProc
(String functionName, String moduleName, Object... args) Deprecated.The stored proc feature and API are experimental, and subject to change in a future release.callStoredProcEncoded
(String functionName, String moduleName, String argsEncoded) Deprecated.The stored proc feature and API are experimental, and subject to change in a future release.void
void
clearMappings
(boolean includeAutoEncodedPrimitiveTypes) void
void
close()
void
commit()
void
commit
(AGHttpRepoClient.CommitPhase phase, Xid xid) Prepares or finalizes a previous prepared commit depending on the value of phase.void
createFreetextIndex
(String name, List<String> predicates, boolean indexLiterals, List<String> indexLiteralTypes, String indexResources, List<String> indexFields, int minimumWordSize, List<String> stopWords, List<String> wordFilters, List<String> innerChars, List<String> borderChars, String tokenizer) Creates a new freetext index with the given parameters.void
HTTP client layer function for requesting that AG deletes an existing attribute.void
deleteDatatypeMapping
(IRI datatype) void
deleteDuplicates
(String comparisonMode) Deletes all duplicates from the store.void
deleteFreetextIndex
(String index) Delete the freetext index of the given name.void
void
void
deleteJSON
(org.json.JSONArray rows, Resource... contexts) long
deleteMaterialized
(Resource inferredGraph) Deletes materialized statements.void
deletePredicateMapping
(IRI predicate) void
deleteSavedQuery
(String queryName) void
deleteSpinFunction
(String uri) void
void
deleteStatements
(Resource subj, IRI pred, Value obj, Resource... contexts) void
void
void
Disables the spogi triple cache.void
Drops the given index from the list of actively managed indices.void
void
enableTripleCache
(long size) Enables the spogi cache in this repository.void
evalFreetextQuery
(String pattern, String expression, String index, boolean sorted, int limit, int offset, AGResponseHandler handler) evalInServer
(InputStream stream) evalInServer
(String lispForm) boolean
static Resource
getApplicationResource
(Resource stored, AGValueFactory vf) Returns the application Resource for a given stored resource.static Value
getApplicationValue
(Value stored, AGValueFactory vf) Returns the application Value for a given stored value.org.json.JSONArray
Fetch all attribute definitions.org.json.JSONArray
getAttributeDefinition
(String name) Fetch the attribute definition named by NAME.String[]
getBlankNodes
(int blankNodeAmount) void
getContextIDs
(TupleQueryResultHandler handler) String[]
Gets the default RDFFormat to use in making requests that return RDF statements; the format should support contexts.static long
Gets the default lifetime of sessions spawned by any instance unless otherwise specified bysetSessionLifetime(int)
void
getDuplicateStatements
(String comparisonMode, RDFHandler handler) org.json.JSONObject
Gets the configuration of the given index.String[]
Deprecated.String[]
getFreetextPredicates
(String index) void
getGeoBox
(String type_uri, String predicate_uri, float xmin, float xmax, float ymin, float ymax, int limit, boolean infer, AGResponseHandler handler) void
getGeoCircle
(String type_uri, String predicate_uri, float x, float y, float radius, int limit, boolean infer, AGResponseHandler handler) void
getGeoHaversine
(String type_uri, String predicate_uri, float lat, float lon, float radius, String unit, int limit, boolean infer, AGResponseHandler handler) void
getGeoPolygon
(String type_uri, String predicate_uri, String polygon, int limit, boolean infer, AGResponseHandler handler) String[]
getNamespace
(String prefix) void
getNamespaces
(TupleQueryResultHandler handler) boolean
String[]
Gets the RDFFormat to use in making requests that return RDF statements.Fetch the preferredTupleQueryResultFormat
.Xid[]
getQueryOption
(String name) void
getQueryOptions
(TupleQueryResultHandler handler) getRoot()
int
Returns the 'lifetime' for a dedicated session spawned by this instance.boolean
Returns true if the initfile (if any) will be loaded by dedicated sessions spawned by this instance.getSpinFunction
(String uri) void
getStatements
(AGResponseHandler handler, String... ids) void
getStatements
(Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) void
getStatements
(Resource subj, IRI pred, Value obj, String includeInferred, RDFHandler handler, Resource... contexts) void
getStatements
(RDFHandler handler, String... ids) void
getStatementsCountLimit
(int limit, Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) Retrieves the count of statements matching the provided subject, predicate, object and contexts, but does not read more than a specified number of statements; feeds the result to the response handler.void
getStatementsLimit
(int limit, Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) Retrieves up to a specified number of statements matching the provided subject, predicate, object and contexts, and feeds the result to the response handler.Returns a storable Resource for the given Resource.getStorableValue
(Value v, AGValueFactory vf) Returns a storable Value for the given Value.static Value
getStorableValue
(Value v, AGValueFactory vf, boolean allowExternalBlankNodeIds) long
Returns the storeID as a longGets the distributed transaction settings.long
Returns the size of the spogi cache.int
Gets the commit period used when uploading statements.Return the current userAttributes setting for this connection.boolean
boolean
Lists the free text indices defined on the repository.listIndices
(boolean listValid) Returns a list of indices for this repository.void
void
load
(String serverAbsolutePath, String baseURI, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) void
void
load
(IRI source, String baseURI, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) long
materialize
(AGMaterializer materializer) Materializes inferred statements (generates and adds them to the store).void
optimizeIndices
(Boolean wait) void
optimizeIndices
(Boolean wait, int level) void
ping()
void
void
void
query
(AGQuery q, boolean analyzeOnly, AGResponseHandler handler) registerCartesianType
(float stripWidth, float xmin, float xmax, float ymin, float ymax) void
registerDatatypeMapping
(IRI datatype, IRI primitiveType) void
registerEncodableNamespace
(String namespace, String format) void
registerEncodableNamespaces
(org.json.JSONArray formattedNamespaces) void
registerPolygon
(String polygon, List<String> points) void
registerPredicateMapping
(IRI predicate, IRI primitiveType) void
registerSNAGenerator
(String generator, List<String> objectOfs, List<String> subjectOfs, List<String> undirecteds, String query) void
registerSNANeighborMatrix
(String matrix, String generator, List<String> group, int depth) registerSphericalType
(float stripWidth, String unit, float latmin, float longmin, float latmax, float longmax) void
removeNamespacePrefix
(String prefix) void
removeQueryOption
(String name) void
rollback()
void
Aborts a previously prepared commitvoid
sendRDFTransaction
(InputStream rdftransaction) void
sendRDFTransaction
(InputStream rdftransaction, org.json.JSONObject attributes) void
setAllowExternalBlankNodeIds
(boolean allow) Enables/Disables an option to support external blank nodes (experimental).void
setAutoCommit
(boolean autoCommit) static void
setDefaultSessionLifetime
(int lifetimeInSeconds) Sets the default lifetime of sessions spawned by any instance when none is specified bysetSessionLifetime(int)
void
setMasqueradeAsUser
(String user) Sets the AG user for X-Masquerade-As-User requests.void
setNamespacePrefix
(String prefix, String name) void
setPreferredBQRFormat
(BooleanQueryResultFormat preferredBQRFormat) void
setPreferredRDFFormat
(RDFFormat preferredRDFFormat) Sets the RDFFormat to use in making requests that return RDF statements; the format must support contexts.void
setPreferredTQRFormat
(TupleQueryResultFormat preferredTQRFormat) Set the preferredTupleQueryResultFormat
void
setQueryOption
(String name, String value) void
setSendRollbackHeader
(boolean sendRollbackHeader) When set to true, an x-rollback header will be passed with each request made by this AGHttpRepoClient instance.void
setSessionLifetime
(int lifetimeInSeconds) Sets the 'lifetime' for a dedicated session spawned by this instance.void
setSessionLoadInitFile
(boolean loadInitFile) When true, dedicated sessions will load the initfile upon creation.void
setStaticAttributeFilter
(String filter) void
setTransactionSettings
(TransactionSettings transactionSettings) Change the transaction settings related to multi-master replication.void
setUploadCommitPeriod
(int period) Sets the commit period to use when uploading statements.void
setUserAttributes
(String value) Set the user attributes for this connection.long
toString()
void
unregisterEncodableNamespace
(String namespace) void
upload
(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, long size, String contentEncoding, org.json.JSONObject attributes, Resource... contexts) void
upload
(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, org.json.JSONObject attributes, Resource... contexts) void
upload
(Reader contents, String baseURI, RDFFormat dataFormat, boolean overwrite, org.json.JSONObject attributes, Resource... contexts) void
upload
(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, Resource... contexts) void
upload
(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, String contentEncoding, Resource... contexts) void
upload
(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) void
upload
(org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, String contentEncoding, Resource... contexts) void
upload
(org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) void
uploadJSON
(String url, org.json.JSONArray rows, Resource... contexts) void
uploadJSON
(org.json.JSONArray rows, Resource... contexts) boolean
Checks the System property com.franz.agraph.http.useMainPortForSessions (defaults to false).void
warmup()
Asks the server to read store's internal data structures into memory.void
warmup
(WarmupConfig config) Asks the server to read store's internal data structures into memory.
-
Field Details
-
savedQueryDeleteQueue
-
-
Constructor Details
-
AGHttpRepoClient
public AGHttpRepoClient(AGAbstractRepository repo, AGHTTPClient client, String repoRoot, String sessionRoot, ScheduledExecutorService executor) -
AGHttpRepoClient
public AGHttpRepoClient(AGAbstractRepository repo, AGHTTPClient client, String repoRoot, String sessionRoot)
-
-
Method Details
-
getDefaultSessionLifetime
public static long getDefaultSessionLifetime()Gets the default lifetime of sessions spawned by any instance unless otherwise specified bysetSessionLifetime(int)
- Returns:
- long defaultSessionLifetimeInSeconds
-
setDefaultSessionLifetime
public static void setDefaultSessionLifetime(int lifetimeInSeconds) Sets the default lifetime of sessions spawned by any instance when none is specified bysetSessionLifetime(int)
Defaults to 3600 seconds (1 hour).
- Parameters:
lifetimeInSeconds
- Number of seconds before the session times out
-
getStorableValue
-
getApplicationResource
Returns the application Resource for a given stored resource.This method is intended for use within the AG client library, not for use by applications.
- Parameters:
stored
- a stored resourcevf
- a value factory that can create new store values- Returns:
- the application resource
- Since:
- v4.4
- See Also:
-
getApplicationValue
Returns the application Value for a given stored value.This method is intended for use within the AG client library, not for use by applications.
- Parameters:
stored
- a stored valuevf
- a value factory that can create new store values- Returns:
- the application value
- Since:
- v4.4
- See Also:
-
toString
-
getRoot
- Throws:
AGHttpException
-
usingMainPortForSessions
public boolean usingMainPortForSessions()Checks the System property com.franz.agraph.http.useMainPortForSessions (defaults to false).- Returns:
- boolean true if proxying sessions through the main server port.
-
getValueFactory
-
getSessionLifetime
public int getSessionLifetime()Returns the 'lifetime' for a dedicated session spawned by this instance.- Returns:
- lifetime in seconds
-
setSessionLifetime
public void setSessionLifetime(int lifetimeInSeconds) Sets the 'lifetime' for a dedicated session spawned by this instance.- Parameters:
lifetimeInSeconds
- an integer number of seconds
-
getSessionLoadInitFile
public boolean getSessionLoadInitFile()Returns true if the initfile (if any) will be loaded by dedicated sessions spawned by this instance.- Returns:
- boolean the current setting of 'loadInitFile'
-
setSessionLoadInitFile
public void setSessionLoadInitFile(boolean loadInitFile) When true, dedicated sessions will load the initfile upon creation.- Parameters:
loadInitFile
- boolean indicating the new value to set
-
addSessionLoadScript
Adds a 'script' for a dedicated session spawned by this instance.- Parameters:
scriptName
- the name of the script to be added to the list of scripts loaded for this session
-
getPreferredTQRFormat
Fetch the preferredTupleQueryResultFormat
.- Returns:
- TupleQueryResultFormat the current preferred format
-
setPreferredTQRFormat
Set the preferredTupleQueryResultFormat
- Parameters:
preferredTQRFormat
- the new value to set as preferred
-
getPreferredBQRFormat
-
setPreferredBQRFormat
-
getDefaultRDFFormat
Gets the default RDFFormat to use in making requests that return RDF statements; the format should support contexts.Gets System property com.franz.agraph.http.defaultRDFFormat (NQUADS and TRIX are currently supported), defaults to TRIX if the property is not present, and returns the corresponding RDFFormat.
- Returns:
- an RDFFormat, either NQUADS or TRIX
-
getPreferredRDFFormat
Gets the RDFFormat to use in making requests that return RDF statements.Defaults to the format returned by
getDefaultRDFFormat()
- Returns:
- an RDFFormat, either NQUADS or TRIX
-
setPreferredRDFFormat
Sets the RDFFormat to use in making requests that return RDF statements; the format must support contexts.AGRDFFormat.NQUADS and RDFFormat.TRIX are currently supported. Defaults to the format returned by
getDefaultRDFFormat()
- Parameters:
preferredRDFFormat
- The newRDFFormat
to set as preferred
-
getServerURL
-
getHTTPClient
-
getStatements
public void getStatements(Resource subj, IRI pred, Value obj, String includeInferred, RDFHandler handler, Resource... contexts) throws RDFHandlerException, AGHttpException - Throws:
RDFHandlerException
AGHttpException
-
getStatementsCountLimit
public void getStatementsCountLimit(int limit, Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) throws AGHttpException Retrieves the count of statements matching the provided subject, predicate, object and contexts, but does not read more than a specified number of statements; feeds the result to the response handler.- Parameters:
limit
- Maximum number of statements to countsubj
- Subject filterpred
- Predicate filterobj
- Object filterincludeInferred
- If true, inferred triples will be included in the sethandler
- Response handlercontexts
- Optional context filter- Throws:
AGHttpException
- if an error occurs.
-
getStatementsLimit
public void getStatementsLimit(int limit, Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) throws AGHttpException Retrieves up to a specified number of statements matching the provided subject, predicate, object and contexts, and feeds the result to the response handler.- Parameters:
limit
- Maximum number of statements to retrievesubj
- Subject filterpred
- Predicate filterobj
- Object filterincludeInferred
- If true, inferred triples will be included in the resulthandler
- Response handlercontexts
- Optional context filter- Throws:
AGHttpException
- if an error occurs.
-
getStatements
public void getStatements(Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
getStatements
- Throws:
AGHttpException
-
getStatements
- Throws:
AGHttpException
-
addStatements
public void addStatements(Resource subj, IRI pred, Value obj, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
deleteStatements
public void deleteStatements(Resource subj, IRI pred, Value obj, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
isDedicatedSession
public boolean isDedicatedSession() -
isAutoCommit
- Throws:
AGHttpException
-
setAutoCommit
- Throws:
AGHttpException
-
getUploadCommitPeriod
public int getUploadCommitPeriod()Gets the commit period used when uploading statements.- Returns:
- int The value of the current commit period in triples
- See Also:
-
setUploadCommitPeriod
public void setUploadCommitPeriod(int period) Sets the commit period to use when uploading statements.Causes a commit to happen after every period=N added statements inside a call to
upload(String, HttpEntity, String, boolean, String, IRI, RDFFormat, Resource...)
Defaults to period=0, meaning that no commits are done in an upload.
Setting period > 0 can be used to work around the fact that uploading a huge amount of statements in a single transaction will require excessive amounts of memory.
- Parameters:
period
- A non-negative integer- See Also:
-
commit
Prepares or finalizes a previous prepared commit depending on the value of phase.- Parameters:
phase
- CommitPhase.PREPARE or CommitPhase.COMMITxid
- The transaction xid- Throws:
AGHttpException
- if an error occurs.
-
commit
- Throws:
AGHttpException
-
rollback
- Throws:
AGHttpException
-
rollback
Aborts a previously prepared commit- Parameters:
xid
- The transaction id of the prepared commit to abort.- Throws:
AGHttpException
- if an error occurs.
-
getPreparedTransactions
- Returns:
- an array of Xids of transactions that are in the prepared state on the server.
- Throws:
DecoderException
- if the response from the server is invalid.
-
setSendRollbackHeader
public void setSendRollbackHeader(boolean sendRollbackHeader) When set to true, an x-rollback header will be passed with each request made by this AGHttpRepoClient instance.- Parameters:
sendRollbackHeader
- boolean indicating whether each request should include a rollback header.
-
clearNamespaces
- Throws:
AGHttpException
-
upload
public void upload(Reader contents, String baseURI, RDFFormat dataFormat, boolean overwrite, org.json.JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException - Throws:
RDFParseException
AGHttpException
-
upload
public void upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, org.json.JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException - Throws:
RDFParseException
AGHttpException
-
upload
public void upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, long size, String contentEncoding, org.json.JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException - Throws:
RDFParseException
AGHttpException
-
sendRDFTransaction
- Throws:
AGHttpException
-
sendRDFTransaction
public void sendRDFTransaction(InputStream rdftransaction, org.json.JSONObject attributes) throws AGHttpException - Throws:
AGHttpException
-
uploadJSON
- Throws:
AGHttpException
-
uploadJSON
public void uploadJSON(String url, org.json.JSONArray rows, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
deleteJSON
- Throws:
AGHttpException
-
load
public void load(IRI source, String baseURI, RDFFormat dataFormat, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
load
public void load(IRI source, String baseURI, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
load
public void load(String serverAbsolutePath, String baseURI, RDFFormat dataFormat, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
load
public void load(String serverAbsolutePath, String baseURI, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
upload
public void upload(org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
upload
public void upload(org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, String contentEncoding, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
upload
public void upload(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
upload
public void upload(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
upload
public void upload(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, org.json.JSONObject attributes, String contentEncoding, Resource... contexts) throws AGHttpException - Throws:
AGHttpException
-
getContextIDs
- Throws:
AGHttpException
-
getContextIDs
public void getContextIDs(TupleQueryResultHandler handler) throws TupleQueryResultHandlerException, AGHttpException -
size
- Throws:
AGHttpException
-
getNamespaces
- Throws:
AGHttpException
-
getNamespaces
public void getNamespaces(TupleQueryResultHandler handler) throws TupleQueryResultHandlerException, AGHttpException -
getNamespace
- Throws:
AGHttpException
-
setNamespacePrefix
- Throws:
AGHttpException
-
removeNamespacePrefix
- Throws:
AGHttpException
-
getQueryOptions
- Throws:
AGHttpException
-
getQueryOptions
public void getQueryOptions(TupleQueryResultHandler handler) throws TupleQueryResultHandlerException, AGHttpException -
getQueryOption
- Throws:
AGHttpException
-
setQueryOption
- Throws:
AGHttpException
-
removeQueryOption
- Throws:
AGHttpException
-
query
- Throws:
AGHttpException
-
deleteSavedQuery
- Throws:
AGHttpException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
AGHttpException
-
createFreetextIndex
public void createFreetextIndex(String name, List<String> predicates, boolean indexLiterals, List<String> indexLiteralTypes, String indexResources, List<String> indexFields, int minimumWordSize, List<String> stopWords, List<String> wordFilters, List<String> innerChars, List<String> borderChars, String tokenizer) throws AGHttpException Creates a new freetext index with the given parameters.- Parameters:
name
- the name of the new indexpredicates
- the predicates that will cause triples to be indexedindexLiterals
- true if literals should be indexedindexLiteralTypes
- the datatypes of Literals that should be indexed.indexResources
- true if resources should be indexedindexFields
- the fields (s, p, o, g) to index.minimumWordSize
- the smallest word that will be indexed.stopWords
- list of words that will not be indexedwordFilters
- filters to apply to words before they are indexed.innerChars
- list of characters that constitute a wordborderChars
- list of characters that can begin/terminate a wordtokenizer
- the name of a supported tokenizer- Throws:
AGHttpException
- if there's a problem with the index parameters or handling the request.See also the protocol documentation for freetext index parameters
.
-
deleteFreetextIndex
Delete the freetext index of the given name.- Parameters:
index
- the name of the index to delete- Throws:
AGHttpException
- if an error occurs while deleting
-
listFreetextIndices
Lists the free text indices defined on the repository.- Returns:
- a list of index names
- Throws:
AGHttpException
- if an error occurs with the request
-
getFreetextIndices
Deprecated.- Returns:
- String[] the list of defined freetext indices
- Throws:
AGHttpException
- if there is a problem with the request- See Also:
-
getFreetextIndexConfiguration
public org.json.JSONObject getFreetextIndexConfiguration(String index) throws AGHttpException, org.json.JSONException Gets the configuration of the given index.- Parameters:
index
- the name of the index to lookup- Returns:
- JSONObject a description of the index configuration
- Throws:
AGHttpException
- if there is an error delivering the requestorg.json.JSONException
- if there is an error parsing the request into JSON
-
getFreetextPredicates
- Throws:
AGHttpException
-
evalFreetextQuery
public void evalFreetextQuery(String pattern, String expression, String index, boolean sorted, int limit, int offset, AGResponseHandler handler) throws AGHttpException - Throws:
AGHttpException
-
registerPredicateMapping
- Throws:
AGHttpException
-
deletePredicateMapping
- Throws:
AGHttpException
-
getPredicateMappings
- Throws:
AGHttpException
-
registerDatatypeMapping
- Throws:
AGHttpException
-
deleteDatatypeMapping
- Throws:
AGHttpException
-
getDatatypeMappings
- Throws:
AGHttpException
-
clearMappings
- Throws:
AGHttpException
-
clearMappings
- Throws:
AGHttpException
-
addRules
- Throws:
AGHttpException
-
addRules
- Throws:
AGHttpException
-
evalInServer
- Throws:
AGHttpException
-
evalInServer
- Throws:
AGHttpException
-
ping
- Throws:
AGHttpException
-
getGeoTypes
- Throws:
AGHttpException
-
registerCartesianType
public String registerCartesianType(float stripWidth, float xmin, float xmax, float ymin, float ymax) throws AGHttpException - Throws:
AGHttpException
-
registerSphericalType
public String registerSphericalType(float stripWidth, String unit, float latmin, float longmin, float latmax, float longmax) throws AGHttpException - Throws:
AGHttpException
-
registerPolygon
- Throws:
AGHttpException
-
getGeoBox
public void getGeoBox(String type_uri, String predicate_uri, float xmin, float xmax, float ymin, float ymax, int limit, boolean infer, AGResponseHandler handler) throws AGHttpException - Throws:
AGHttpException
-
getGeoCircle
public void getGeoCircle(String type_uri, String predicate_uri, float x, float y, float radius, int limit, boolean infer, AGResponseHandler handler) throws AGHttpException - Throws:
AGHttpException
-
getGeoHaversine
public void getGeoHaversine(String type_uri, String predicate_uri, float lat, float lon, float radius, String unit, int limit, boolean infer, AGResponseHandler handler) throws AGHttpException - Throws:
AGHttpException
-
getGeoPolygon
public void getGeoPolygon(String type_uri, String predicate_uri, String polygon, int limit, boolean infer, AGResponseHandler handler) throws AGHttpException - Throws:
AGHttpException
-
registerSNAGenerator
public void registerSNAGenerator(String generator, List<String> objectOfs, List<String> subjectOfs, List<String> undirecteds, String query) throws AGHttpException - Throws:
AGHttpException
-
registerSNANeighborMatrix
public void registerSNANeighborMatrix(String matrix, String generator, List<String> group, int depth) throws AGHttpException - Throws:
AGHttpException
-
listIndices
Returns a list of indices for this repository. When listValid is true, return all possible valid index types for this store; when listValid is false, return only the current actively managed index types.- Parameters:
listValid
- true yields all valid types, false yields active types- Returns:
- list of indices, never null
- Throws:
AGHttpException
- if there is a problem with the request
-
addIndex
Adds the given index to the list of actively managed indices. This will take affect on the next commit.- Parameters:
index
- a valid index type- Throws:
AGHttpException
- if there is a problem with the request- See Also:
-
dropIndex
Drops the given index from the list of actively managed indices. This will take affect on the next commit.- Parameters:
index
- a valid index type- Throws:
AGHttpException
- if there is a problem with the request- See Also:
-
registerEncodableNamespace
- Throws:
AGHttpException
-
unregisterEncodableNamespace
- Throws:
AGHttpException
-
enableTripleCache
Enables the spogi cache in this repository.- Parameters:
size
- the size of the cache, in triples- Throws:
AGHttpException
- if there is a problem with the request
-
registerEncodableNamespaces
public void registerEncodableNamespaces(org.json.JSONArray formattedNamespaces) throws AGHttpException - Throws:
AGHttpException
-
getEncodableNamespaces
- Throws:
AGHttpException
-
callStoredProcEncoded
@Deprecated public String callStoredProcEncoded(String functionName, String moduleName, String argsEncoded) throws AGHttpException Deprecated.The stored proc feature and API are experimental, and subject to change in a future release.Invoke a stored procedure on the AllegroGraph server. The args must already be encoded, and the response is encoded.Low-level access to the data sent to the server can be done with:
{@link AGDeserializer#decodeAndDeserialize(String) AGDeserializer.decodeAndDeserialize}( callStoredProcEncoded(functionName, moduleName, {@link AGSerializer#serializeAndEncode(Object[]) AGSerializer.serializeAndEncode}(args)));
If an error occurs in the stored procedure then result will be a two element vector with the first element being the string "_fail_" and the second element being the error message (also a string).
callStoredProc(String, String, Object...)
does this encoding, decoding, and throws exceptions for error result.- Parameters:
functionName
- stored proc lisp function, for example "addTwo"moduleName
- lisp FASL file name, for example "example.fasl"argsEncoded
- byte-encoded arguments to the stored procedure- Returns:
- String byte-encoded response from stored proc
- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.2
- See Also:
-
callStoredProc
@Deprecated public Object callStoredProc(String functionName, String moduleName, Object... args) throws AGHttpException Deprecated.The stored proc feature and API are experimental, and subject to change in a future release.Invoke a stored procedure on the AllegroGraph server.The input arguments and the return value can be:
String
,Integer
, null, byte[], or Object[] orList
of these (can be nested).- Parameters:
functionName
- stored proc lisp function, for example "addTwo"moduleName
- lisp FASL file name, for example "example.fasl"args
- arguments to the stored proc- Returns:
- Object return value of stored proc
- Throws:
AGCustomStoredProcException
- for errors from stored procAGHttpException
- Since:
- v4.2
- See Also:
-
getStoreID
Returns the storeID as a long- Returns:
- The store ID
- Throws:
AGHttpException
- if there is a problem with the request
-
getTripleCacheSize
Returns the size of the spogi cache.- Returns:
- long the size of the spogi cache, in triples
- Throws:
AGHttpException
- if there is a problem with the request
-
disableTripleCache
Disables the spogi triple cache.- Throws:
AGHttpException
- if there is a problem with the request
-
getBlankNodes
- Throws:
AGHttpException
-
deleteDuplicates
Deletes all duplicates from the store.The comparisonMode determines what will be deemed a "duplicate".
If comparisonMode is "spog", quad parts (s,p,o,g) will all be compared when looking for duplicates.
If comparisonMode is "spo", only the (s,p,o) parts will be compared; the same triple in different graphs will thus be deemed duplicates.
See also the protocol documentation for deleting duplicates
- Parameters:
comparisonMode
- determines what is a duplicate- Throws:
AGHttpException
- if there is a problem with the request
-
getDuplicateStatements
public void getDuplicateStatements(String comparisonMode, RDFHandler handler) throws AGHttpException, RDFHandlerException - Throws:
AGHttpException
RDFHandlerException
-
materialize
Materializes inferred statements (generates and adds them to the store).The materializer's configuration determines how statements are materialized.
- Parameters:
materializer
- the materializer to use- Returns:
- long the number of statements added
- Throws:
AGHttpException
- if there is a problem with the request- See Also:
-
deleteMaterialized
Deletes materialized statements.- Parameters:
inferredGraph
- Graph to delete the triples from. If null the default graph will be used.- Returns:
- long the number of statements deleted
- Throws:
AGHttpException
- if there is a problem with the requestRepositoryException
- See Also:
-
optimizeIndices
- Throws:
AGHttpException
-
optimizeIndices
- Throws:
AGHttpException
-
getSpinFunction
- Parameters:
uri
- name of the SPIN magic property to retrieve- Returns:
- String a string representation of the property definition
- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
listSpinFunctions
- Returns:
TupleQueryResult
a list of defined SPIN magic properties- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
putSpinFunction
- Parameters:
fn
- the SPIN magic property to add- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
deleteSpinFunction
- Parameters:
uri
- name of the SPIN magic property to delete- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
deleteHardSpinFunction
- Parameters:
uri
- name of the SPIN magic property to delete- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
getSpinMagicProperty
- Parameters:
uri
- name of the SPIN magic property to retrieve- Returns:
- String a string representation of the property definition
- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
listSpinMagicProperties
- Returns:
TupleQueryResult
a list of defined SPIN magic properties- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
putSpinMagicProperty
- Parameters:
fn
- the SPIN magic property to add- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
deleteSpinMagicProperty
- Parameters:
uri
- The uri naming the SPIN magic property to delete- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
deleteHardSpinMagicProperty
- Parameters:
uri
- The uri naming the SPIN magic property to delete- Throws:
AGHttpException
- if there is a problem with the request- Since:
- v4.4
-
getAllowExternalBlankNodeIds
public boolean getAllowExternalBlankNodeIds()- Returns:
- true iff this HTTP/Storage layer allows external blank node ids.
- Since:
- v4.4
- See Also:
-
setAllowExternalBlankNodeIds
public void setAllowExternalBlankNodeIds(boolean allow) Enables/Disables an option to support external blank nodes (experimental).Disabled by default. Enable it from an AGRepositoryConnection using:
conn.prepareHttpRepoClient().setAllowExternalBlankNodeIds(true);
An external blank node is a blank node whose id is not generated by AllegroGraph. Applications should normally request new blank nodes from AllegroGraph [via the AGValueFactory#createBNode() method in the Sesame api, or via the AGModel#createResource() method in the Jena adapter]; this helps to avoid unintended blank node id collisions (particularly in a multi-user setting) and enables blank nodes to be stored more efficiently, etc.
Previously, for applications that did use an external blank node id [such as via AGValueFactory#createBNode("ex") in Sesame, or in Jena via AGModel#createResource(AnonId.create("ex"))] or an external blank node factory [such as ValueFactoryImpl#createBNode() in Sesame or ResourceFactory#createResource() in Jena], there were some issues that arose. When the application tried to add a statement such as [_:ex p a] over HTTP, the AllegroGraph server allocates a new blank node id to use in place of the external blank node id _:ex, so that the actual statement stored is something like [_:bF010696Fx1 p a].
There are 2 issues with this:
1) adding a second statement such as [_:ex q b] in a subsequent request will result in another new bnode id being allocated, so that the statement stored might be [_:bF010696Fx2 q b], and the link between the two statements (that exists client side via blank node _:ex) is now lost.
2) trying to get the statement [_:ex p a] will fail, because the actual statement stored is [_:bF010696Fx1 p a].
Note that these issues arise with external blank node ids because the server does not know their scope, and by default assumes that the scope is limited to the HTTP request in order to avoid blank node conflicts. When AG-allocated blank node ids are used instead, the two issues above do not arise (they are stored as is, and they will be found as expected with a get). In short, AG-allocated blank nodes round-trip, external blank nodes do not.
One workaround for this is to have applications declare that they want external blank nodes to round-trip. An external blank node can exist for the life of an application, and that life can exceed the life of an AllegroGraph server instance, so adding a statement with an external blank node will need to persist the external blank node's id somehow. AllegroGraph doesn't currently allow storing blank nodes with an arbitrary external id, so this workaround converts them to URI's (of the form "urn:x-bnode:id" by default) for storage, and recovers the blank nodes with correct ids when the values are retrieved in queries, so that applications continue to transparently deal with BNodes and see the expected behavior w.r.t. issues 1) and 2) above.
When enabling the workaround described here, the application must take responsibility for using an external blank node factory that avoids blank node conflicts, and must also be willing to incur the additional costs of storing external blank nodes as URIs. When the workaround is disabled (allow=false, the default), the application must avoid using external blank nodes with AG (using AG-allocated blank nodes instead); using external blank node ids when they are not allowed will result in an explanatory exception (as opposed to quietly exhibiting the two problems described above).
This method and approach are experimental and subject to change.
- Parameters:
allow
- true enables a workaround to support external bnodes- Since:
- v4.4
- See Also:
-
getStorableResource
Returns a storable Resource for the given Resource.The intent is that the returned resource can be stored in an AG repository, will round-trip if added to and retrieved from the repository, and that the given Resource can be cheaply recreated from the returned resource.
This method simply returns the original resource when it is a URI or a BNode with an AG generated blank node id (these can be stored and will round-trip). For external BNodes (with an id that does not look like it was generated by AG), a URI of the form "urn:x-bnode:id" is returned when the connection allows external blank nodes; otherwise, an IllegalArgumentException is thrown explaining the need to either avoid external blank nodes or enable the workaround for external blank nodes.
This method is intended for use within the AG client library, not for use by applications.
- Parameters:
r
- a resourcevf
- a value factory that can create new store values- Returns:
- a storable resource for the given resource
- Since:
- v4.4
- See Also:
-
getStorableValue
Returns a storable Value for the given Value.The intent is that the returned value can be stored in an AG repository, will round-trip if added to and retrieved from the repository, and that the given Value can be cheaply recreated from the returned value.
This method simply returns the original value when it is a URI, Literal, or BNode with AG generated blank node id (these can be stored and will round-trip). For external BNodes (with an id that does not look like it was generated by AG), a URI of the form "urn:x-bnode:id" is returned when the connection allows external blank nodes; otherwise, an IllegalArgumentException is thrown explaining the need to either avoid external blank nodes or enable the workaround for external blank nodes.
This method is intended for use within the AG client library, not for use by applications.
- Parameters:
v
- a valuevf
- a value factory that can create new store values- Returns:
- a storable value for the given value
- Since:
- v4.4
- See Also:
-
setMasqueradeAsUser
Sets the AG user for X-Masquerade-As-User requests.For AG superusers only. This allows AG superusers to run requests as another user in a dedicated session.
- Parameters:
user
- the user for X-Masquerade-As-User requests- Throws:
RepositoryException
- if an error occurs
-
addAttributeDefinition
public void addAttributeDefinition(String name, List<String> allowedValues, boolean ordered, long minimum, long maximum) throws AGHttpException HTTP client layer function for requesting that AG define a new attribute. Only parameters explicitly set by the client will be passed to the request.- Parameters:
name
- the name of the attribute being definedallowedValues
- list of allowed values (null means all values allowed)ordered
- true ifallowedValues
are orderedminimum
- the minimum number of times this attribute can be specifiedmaximum
- the maximum number of times this attribute can be specified- Throws:
AGHttpException
- if there's a problem with the request
-
deleteAttributeDefinition
HTTP client layer function for requesting that AG deletes an existing attribute.- Parameters:
name
- the attribute to delete- Throws:
AGHttpException
- if there's a problem with the request
-
getAttributeDefinition
Fetch all attribute definitions.- Returns:
- JSONArray containing a JSONObject for each attribute
- Throws:
AGHttpException
- if there's a problem with the requestorg.json.JSONException
- if there's a problem parsing the request into JSON
-
getAttributeDefinition
public org.json.JSONArray getAttributeDefinition(String name) throws AGHttpException, org.json.JSONException Fetch the attribute definition named by NAME. Return all definitions if NAME is null.- Parameters:
name
- of the attribute- Returns:
- a JSONArray containing a JSONObject for the attribute found, or all attributes if NAME is null
- Throws:
AGHttpException
- if there's a problem with the requestorg.json.JSONException
- if there's a problem parsing the request into JSON
-
getStaticAttributeFilter
- Throws:
AGHttpException
-
setStaticAttributeFilter
- Throws:
AGHttpException
-
deleteStaticAttributeFilter
- Throws:
AGHttpException
-
getNDGeospatialDatatypeAutomation
- Throws:
AGHttpException
-
enableNDGeospatialDatatypeAutomation
- Throws:
AGHttpException
-
disableNDGeospatialDatatypeAutomation
- Throws:
AGHttpException
-
getUserAttributes
Return the current userAttributes setting for this connection.- Returns:
- String containing a json representation of the attributes
-
setUserAttributes
Set the user attributes for this connection.- Parameters:
value
- , a String containing a serialized JSON object of the attributes
-
getTransactionSettings
Gets the distributed transaction settings.- Returns:
- Settings (possibly
null
).
-
setTransactionSettings
Change the transaction settings related to multi-master replication.- Parameters:
transactionSettings
- New settings ornull
, meaning "use server-chosen defaults for all settings".
-
warmup
public void warmup()Asks the server to read store's internal data structures into memory. Usewarmup(WarmupConfig)
to specify which structures should be read. -
warmup
Asks the server to read store's internal data structures into memory.- Parameters:
config
- Config object that can be used to specify which structures should be read into memory. If this parameter isnull
then the choice will be left to the server.
-