public class AGHttpRepoClient extends Object implements AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
AGHttpRepoClient.CommitPhase |
Modifier and Type | Field and Description |
---|---|
ConcurrentLinkedQueue<String> |
savedQueryDeleteQueue |
Constructor and Description |
---|
AGHttpRepoClient(AGAbstractRepository repo,
AGHTTPClient client,
String repoRoot,
String sessionRoot) |
AGHttpRepoClient(AGAbstractRepository repo,
AGHTTPClient client,
String repoRoot,
String sessionRoot,
ScheduledExecutorService executor) |
Modifier and Type | Method and Description |
---|---|
void |
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 |
addIndex(String index)
Adds the given index to the list of actively managed indices.
|
void |
addRules(InputStream rulestream) |
void |
addRules(String rules) |
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) |
Object |
callStoredProc(String functionName,
String moduleName,
Object... args)
Deprecated.
The stored proc feature and API are experimental, and subject to change in a future release.
|
String |
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 |
clearMappings() |
void |
clearMappings(boolean includeAutoEncodedPrimitiveTypes) |
void |
clearNamespaces() |
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 |
deleteAttributeDefinition(String name)
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 |
deleteHardSpinFunction(String uri) |
void |
deleteHardSpinMagicProperty(String uri) |
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 |
deleteSpinMagicProperty(String uri) |
void |
deleteStatements(Resource subj,
IRI pred,
Value obj,
Resource... contexts) |
void |
deleteStaticAttributeFilter() |
void |
disableNDGeospatialDatatypeAutomation() |
void |
disableTripleCache()
Disables the spogi triple cache.
|
void |
dropIndex(String index)
Drops the given index from the list of actively managed indices.
|
void |
enableNDGeospatialDatatypeAutomation() |
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) |
String |
evalInServer(InputStream stream) |
String |
evalInServer(String lispForm) |
boolean |
getAllowExternalBlankNodeIds() |
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 |
getAttributeDefinition()
Fetch all attribute definitions.
|
org.json.JSONArray |
getAttributeDefinition(String name)
Fetch the attribute definition named by NAME.
|
String[] |
getBlankNodes(int blankNodeAmount) |
TupleQueryResult |
getContextIDs() |
void |
getContextIDs(TupleQueryResultHandler handler) |
String[] |
getDatatypeMappings() |
RDFFormat |
getDefaultRDFFormat()
Gets the default RDFFormat to use in making requests that
return RDF statements; the format should support contexts.
|
static long |
getDefaultSessionLifetime()
Gets the default lifetime of sessions spawned by any instance
unless otherwise specified by
setSessionLifetime(int) |
void |
getDuplicateStatements(String comparisonMode,
RDFHandler handler) |
TupleQueryResult |
getEncodableNamespaces() |
org.json.JSONObject |
getFreetextIndexConfiguration(String index)
Gets the configuration of the given index.
|
String[] |
getFreetextIndices()
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[] |
getGeoTypes() |
AGHTTPClient |
getHTTPClient() |
String |
getNamespace(String prefix) |
TupleQueryResult |
getNamespaces() |
void |
getNamespaces(TupleQueryResultHandler handler) |
boolean |
getNDGeospatialDatatypeAutomation() |
String[] |
getPredicateMappings() |
BooleanQueryResultFormat |
getPreferredBQRFormat() |
RDFFormat |
getPreferredRDFFormat()
Gets the RDFFormat to use in making requests that return
RDF statements.
|
TupleQueryResultFormat |
getPreferredTQRFormat()
Fetch the preferred
TupleQueryResultFormat . |
Xid[] |
getPreparedTransactions() |
String |
getQueryOption(String name) |
TupleQueryResult |
getQueryOptions() |
void |
getQueryOptions(TupleQueryResultHandler handler) |
String |
getRoot() |
String |
getServerURL() |
int |
getSessionLifetime()
Returns the 'lifetime' for a dedicated session spawned by this instance.
|
boolean |
getSessionLoadInitFile()
Returns true if the initfile (if any) will be loaded by dedicated
sessions spawned by this instance.
|
String |
getSpinFunction(String uri) |
String |
getSpinMagicProperty(String uri) |
void |
getStatements(AGResponseHandler handler,
String... ids) |
void |
getStatements(RDFHandler 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 |
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.
|
String |
getStaticAttributeFilter() |
Resource |
getStorableResource(Resource r,
AGValueFactory vf)
Returns a storable Resource for the given Resource.
|
Value |
getStorableValue(Value v,
AGValueFactory vf)
Returns a storable Value for the given Value.
|
static Value |
getStorableValue(Value v,
AGValueFactory vf,
boolean allowExternalBlankNodeIds) |
long |
getStoreID()
Returns the storeID as a long
|
TransactionSettings |
getTransactionSettings()
Gets the distributed transaction settings.
|
long |
getTripleCacheSize()
Returns the size of the spogi cache.
|
int |
getUploadCommitPeriod()
Gets the commit period used when uploading statements.
|
String |
getUserAttributes()
Return the current userAttributes setting for this connection.
|
AGValueFactory |
getValueFactory() |
boolean |
isAutoCommit() |
boolean |
isDedicatedSession() |
List<String> |
listFreetextIndices()
Lists the free text indices defined on the repository.
|
List<String> |
listIndices(boolean listValid)
Returns a list of indices for this repository.
|
TupleQueryResult |
listSpinFunctions() |
TupleQueryResult |
listSpinMagicProperties() |
void |
load(IRI source,
String baseURI,
RDFFormat dataFormat,
org.json.JSONObject attributes,
Resource... contexts) |
void |
load(IRI source,
String baseURI,
RDFFormat dataFormat,
Resource... contexts) |
void |
load(String serverAbsolutePath,
String baseURI,
RDFFormat dataFormat,
org.json.JSONObject attributes,
Resource... contexts) |
void |
load(String serverAbsolutePath,
String baseURI,
RDFFormat dataFormat,
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 |
putSpinFunction(AGSpinFunction fn) |
void |
putSpinMagicProperty(AGSpinMagicProperty fn) |
void |
query(AGQuery q,
boolean analyzeOnly,
AGResponseHandler handler) |
String |
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) |
String |
registerSphericalType(float stripWidth,
String unit,
float latmin,
float longmin,
float latmax,
float longmax) |
void |
removeNamespacePrefix(String prefix) |
void |
removeQueryOption(String name) |
void |
rollback() |
void |
rollback(Xid xid)
Aborts a previously prepared commit
|
void |
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 by
setSessionLifetime(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 preferred
TupleQueryResultFormat |
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 |
size(Resource... contexts) |
String |
toString() |
void |
unregisterEncodableNamespace(String namespace) |
void |
upload(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(InputStream contents,
String baseURI,
RDFFormat dataFormat,
boolean overwrite,
org.json.JSONObject attributes,
Resource... contexts) |
void |
upload(InputStream contents,
String baseURI,
RDFFormat dataFormat,
boolean overwrite,
long size,
String contentEncoding,
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,
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,
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,
Resource... contexts) |
void |
uploadJSON(org.json.JSONArray rows,
Resource... contexts) |
void |
uploadJSON(String url,
org.json.JSONArray rows,
Resource... contexts) |
boolean |
usingMainPortForSessions()
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.
|
public ConcurrentLinkedQueue<String> savedQueryDeleteQueue
public AGHttpRepoClient(AGAbstractRepository repo, AGHTTPClient client, String repoRoot, String sessionRoot, ScheduledExecutorService executor)
public AGHttpRepoClient(AGAbstractRepository repo, AGHTTPClient client, String repoRoot, String sessionRoot)
public static long getDefaultSessionLifetime()
setSessionLifetime(int)
public static void setDefaultSessionLifetime(int lifetimeInSeconds)
setSessionLifetime(int)
Defaults to 3600 seconds (1 hour).
lifetimeInSeconds
- Number of seconds before the session times outpublic static Value getStorableValue(Value v, AGValueFactory vf, boolean allowExternalBlankNodeIds)
public static Resource getApplicationResource(Resource stored, AGValueFactory vf)
This method is intended for use within the AG client library, not for use by applications.
stored
- a stored resourcevf
- a value factory that can create new store valuesgetStorableResource(Resource, AGValueFactory)
public static Value getApplicationValue(Value stored, AGValueFactory vf)
This method is intended for use within the AG client library, not for use by applications.
stored
- a stored valuevf
- a value factory that can create new store valuesgetStorableValue(Value, AGValueFactory)
public String getRoot() throws AGHttpException
AGHttpException
public boolean usingMainPortForSessions()
public AGValueFactory getValueFactory()
public int getSessionLifetime()
public void setSessionLifetime(int lifetimeInSeconds)
lifetimeInSeconds
- an integer number of secondspublic boolean getSessionLoadInitFile()
public void setSessionLoadInitFile(boolean loadInitFile)
loadInitFile
- boolean indicating the new value to setpublic void addSessionLoadScript(String scriptName)
scriptName
- the name of the script to be added to the list of scripts
loaded for this sessionpublic TupleQueryResultFormat getPreferredTQRFormat()
TupleQueryResultFormat
.public void setPreferredTQRFormat(TupleQueryResultFormat preferredTQRFormat)
TupleQueryResultFormat
preferredTQRFormat
- the new value to set as preferredpublic BooleanQueryResultFormat getPreferredBQRFormat()
public void setPreferredBQRFormat(BooleanQueryResultFormat preferredBQRFormat)
public RDFFormat getDefaultRDFFormat()
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.
public RDFFormat getPreferredRDFFormat()
Defaults to the format returned by getDefaultRDFFormat()
public void setPreferredRDFFormat(RDFFormat preferredRDFFormat)
AGRDFFormat.NQUADS and RDFFormat.TRIX are currently supported.
Defaults to the format returned by getDefaultRDFFormat()
preferredRDFFormat
- The new RDFFormat
to set as preferredpublic String getServerURL()
public AGHTTPClient getHTTPClient()
public void getStatements(Resource subj, IRI pred, Value obj, String includeInferred, RDFHandler handler, Resource... contexts) throws RDFHandlerException, AGHttpException
RDFHandlerException
AGHttpException
public void getStatementsCountLimit(int limit, Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) throws AGHttpException
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 filterAGHttpException
- if an error occurs.public void getStatementsLimit(int limit, Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) throws AGHttpException
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 filterAGHttpException
- if an error occurs.public void getStatements(Resource subj, IRI pred, Value obj, String includeInferred, AGResponseHandler handler, Resource... contexts) throws AGHttpException
AGHttpException
public void getStatements(RDFHandler handler, String... ids) throws AGHttpException
AGHttpException
public void getStatements(AGResponseHandler handler, String... ids) throws AGHttpException
AGHttpException
public void addStatements(Resource subj, IRI pred, Value obj, Resource... contexts) throws AGHttpException
AGHttpException
public void deleteStatements(Resource subj, IRI pred, Value obj, Resource... contexts) throws AGHttpException
AGHttpException
public boolean isDedicatedSession()
public boolean isAutoCommit() throws AGHttpException
AGHttpException
public void setAutoCommit(boolean autoCommit) throws AGHttpException
AGHttpException
public int getUploadCommitPeriod()
setUploadCommitPeriod(int)
public void setUploadCommitPeriod(int period)
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.
period
- A non-negative integergetUploadCommitPeriod()
public void commit(AGHttpRepoClient.CommitPhase phase, Xid xid) throws AGHttpException
phase
- CommitPhase.PREPARE or CommitPhase.COMMITxid
- The transaction xidAGHttpException
- if an error occurs.public void commit() throws AGHttpException
AGHttpException
public void rollback() throws AGHttpException
AGHttpException
public void rollback(Xid xid) throws AGHttpException
xid
- The transaction id of the prepared commit to abort.AGHttpException
- if an error occurs.public Xid[] getPreparedTransactions() throws org.apache.commons.codec.DecoderException
org.apache.commons.codec.DecoderException
- if the response from the server is invalid.public void setSendRollbackHeader(boolean sendRollbackHeader)
sendRollbackHeader
- boolean indicating whether each request
should include a rollback header.public void clearNamespaces() throws AGHttpException
AGHttpException
public void upload(Reader contents, String baseURI, RDFFormat dataFormat, boolean overwrite, org.json.JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException
RDFParseException
AGHttpException
public void upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, org.json.JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException
RDFParseException
AGHttpException
public void upload(InputStream contents, String baseURI, RDFFormat dataFormat, boolean overwrite, long size, String contentEncoding, org.json.JSONObject attributes, Resource... contexts) throws RDFParseException, AGHttpException
RDFParseException
AGHttpException
public void sendRDFTransaction(InputStream rdftransaction) throws AGHttpException
AGHttpException
public void sendRDFTransaction(InputStream rdftransaction, org.json.JSONObject attributes) throws AGHttpException
AGHttpException
public void uploadJSON(org.json.JSONArray rows, Resource... contexts) throws AGHttpException
AGHttpException
public void uploadJSON(String url, org.json.JSONArray rows, Resource... contexts) throws AGHttpException
AGHttpException
public void deleteJSON(org.json.JSONArray rows, Resource... contexts) throws AGHttpException
AGHttpException
public void load(IRI source, String baseURI, RDFFormat dataFormat, Resource... contexts) throws AGHttpException
AGHttpException
public void load(IRI source, String baseURI, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) throws AGHttpException
AGHttpException
public void load(String serverAbsolutePath, String baseURI, RDFFormat dataFormat, Resource... contexts) throws AGHttpException
AGHttpException
public void load(String serverAbsolutePath, String baseURI, RDFFormat dataFormat, org.json.JSONObject attributes, Resource... contexts) throws AGHttpException
AGHttpException
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
AGHttpException
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
AGHttpException
public void upload(String url, org.apache.http.HttpEntity reqEntity, String baseURI, boolean overwrite, String serverSideFile, IRI serverSideURL, RDFFormat dataFormat, Resource... contexts) throws AGHttpException
AGHttpException
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
AGHttpException
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
AGHttpException
public TupleQueryResult getContextIDs() throws AGHttpException
AGHttpException
public void getContextIDs(TupleQueryResultHandler handler) throws TupleQueryResultHandlerException, AGHttpException
public long size(Resource... contexts) throws AGHttpException
AGHttpException
public TupleQueryResult getNamespaces() throws AGHttpException
AGHttpException
public void getNamespaces(TupleQueryResultHandler handler) throws TupleQueryResultHandlerException, AGHttpException
public String getNamespace(String prefix) throws AGHttpException
AGHttpException
public void setNamespacePrefix(String prefix, String name) throws AGHttpException
AGHttpException
public void removeNamespacePrefix(String prefix) throws AGHttpException
AGHttpException
public TupleQueryResult getQueryOptions() throws AGHttpException
AGHttpException
public void getQueryOptions(TupleQueryResultHandler handler) throws TupleQueryResultHandlerException, AGHttpException
public String getQueryOption(String name) throws AGHttpException
AGHttpException
public void setQueryOption(String name, String value) throws AGHttpException
AGHttpException
public void removeQueryOption(String name) throws AGHttpException
AGHttpException
public void query(AGQuery q, boolean analyzeOnly, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void deleteSavedQuery(String queryName) throws AGHttpException
AGHttpException
public void close() throws AGHttpException
close
in interface AutoCloseable
AGHttpException
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
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 tokenizerAGHttpException
- if there's a problem with the index parameters
or handling the request.
See also the protocol documentation for freetext index parameters
.public void deleteFreetextIndex(String index) throws AGHttpException
index
- the name of the index to deleteAGHttpException
- if an error occurs while deletingpublic List<String> listFreetextIndices() throws AGHttpException
AGHttpException
- if an error occurs with the requestpublic String[] getFreetextIndices() throws AGHttpException
AGHttpException
- if there is a problem with the requestlistFreetextIndices()
public org.json.JSONObject getFreetextIndexConfiguration(String index) throws AGHttpException, org.json.JSONException
index
- the name of the index to lookupAGHttpException
- if there is an error delivering the requestorg.json.JSONException
- if there is an error parsing the request into JSONpublic String[] getFreetextPredicates(String index) throws AGHttpException
AGHttpException
public void evalFreetextQuery(String pattern, String expression, String index, boolean sorted, int limit, int offset, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void registerPredicateMapping(IRI predicate, IRI primitiveType) throws AGHttpException
AGHttpException
public void deletePredicateMapping(IRI predicate) throws AGHttpException
AGHttpException
public String[] getPredicateMappings() throws AGHttpException
AGHttpException
public void registerDatatypeMapping(IRI datatype, IRI primitiveType) throws AGHttpException
AGHttpException
public void deleteDatatypeMapping(IRI datatype) throws AGHttpException
AGHttpException
public String[] getDatatypeMappings() throws AGHttpException
AGHttpException
public void clearMappings() throws AGHttpException
AGHttpException
public void clearMappings(boolean includeAutoEncodedPrimitiveTypes) throws AGHttpException
AGHttpException
public void addRules(String rules) throws AGHttpException
AGHttpException
public void addRules(InputStream rulestream) throws AGHttpException
AGHttpException
public String evalInServer(String lispForm) throws AGHttpException
AGHttpException
public String evalInServer(InputStream stream) throws AGHttpException
AGHttpException
public void ping() throws AGHttpException
AGHttpException
public String[] getGeoTypes() throws AGHttpException
AGHttpException
public String registerCartesianType(float stripWidth, float xmin, float xmax, float ymin, float ymax) throws AGHttpException
AGHttpException
public String registerSphericalType(float stripWidth, String unit, float latmin, float longmin, float latmax, float longmax) throws AGHttpException
AGHttpException
public void registerPolygon(String polygon, List<String> points) throws AGHttpException
AGHttpException
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
AGHttpException
public void getGeoCircle(String type_uri, String predicate_uri, float x, float y, float radius, int limit, boolean infer, AGResponseHandler handler) throws AGHttpException
AGHttpException
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
AGHttpException
public void getGeoPolygon(String type_uri, String predicate_uri, String polygon, int limit, boolean infer, AGResponseHandler handler) throws AGHttpException
AGHttpException
public void registerSNAGenerator(String generator, List<String> objectOfs, List<String> subjectOfs, List<String> undirecteds, String query) throws AGHttpException
AGHttpException
public void registerSNANeighborMatrix(String matrix, String generator, List<String> group, int depth) throws AGHttpException
AGHttpException
public List<String> listIndices(boolean listValid) throws AGHttpException
listValid
- true yields all valid types, false yields active typesAGHttpException
- if there is a problem with the requestpublic void addIndex(String index) throws AGHttpException
index
- a valid index typeAGHttpException
- if there is a problem with the requestlistIndices(boolean)
public void dropIndex(String index) throws AGHttpException
index
- a valid index typeAGHttpException
- if there is a problem with the requestlistIndices(boolean)
public void registerEncodableNamespace(String namespace, String format) throws AGHttpException
AGHttpException
public void unregisterEncodableNamespace(String namespace) throws AGHttpException
AGHttpException
public void enableTripleCache(long size) throws AGHttpException
size
- the size of the cache, in triplesAGHttpException
- if there is a problem with the requestpublic void registerEncodableNamespaces(org.json.JSONArray formattedNamespaces) throws AGHttpException
AGHttpException
public TupleQueryResult getEncodableNamespaces() throws AGHttpException
AGHttpException
public String callStoredProcEncoded(String functionName, String moduleName, String argsEncoded) throws AGHttpException
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.
functionName
- stored proc lisp function, for example "addTwo"moduleName
- lisp FASL file name, for example "example.fasl"argsEncoded
- byte-encoded arguments to the stored procedureAGHttpException
- if there is a problem with the requestcallStoredProc(String, String, Object...)
public Object callStoredProc(String functionName, String moduleName, Object... args) throws AGHttpException
The input arguments and the return value can be:
String
, Integer
, null, byte[],
or Object[] or List
of these (can be nested).
functionName
- stored proc lisp function, for example "addTwo"moduleName
- lisp FASL file name, for example "example.fasl"args
- arguments to the stored procAGCustomStoredProcException
- for errors from stored procAGHttpException
AGSerializer.serializeAndEncode(Object[])
,
AGDeserializer.decodeAndDeserialize(String)
public long getStoreID() throws AGHttpException
AGHttpException
- if there is a problem with the requestpublic long getTripleCacheSize() throws AGHttpException
AGHttpException
- if there is a problem with the requestpublic void disableTripleCache() throws AGHttpException
AGHttpException
- if there is a problem with the requestpublic String[] getBlankNodes(int blankNodeAmount) throws AGHttpException
AGHttpException
public void deleteDuplicates(String comparisonMode) throws AGHttpException
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
comparisonMode
- determines what is a duplicateAGHttpException
- if there is a problem with the requestpublic void getDuplicateStatements(String comparisonMode, RDFHandler handler) throws AGHttpException, RDFHandlerException
AGHttpException
RDFHandlerException
public long materialize(AGMaterializer materializer) throws AGHttpException
The materializer's configuration determines how statements are materialized.
materializer
- the materializer to useAGHttpException
- if there is a problem with the requestAGMaterializer.newInstance()
public long deleteMaterialized(Resource inferredGraph) throws RepositoryException
inferredGraph
- Graph to delete the triples from. If null the default graph will be used.AGHttpException
- if there is a problem with the requestRepositoryException
materialize(AGMaterializer)
public void optimizeIndices(Boolean wait, int level) throws AGHttpException
AGHttpException
public void optimizeIndices(Boolean wait) throws AGHttpException
AGHttpException
public String getSpinFunction(String uri) throws AGHttpException
uri
- name of the SPIN magic property to retrieveAGHttpException
- if there is a problem with the requestpublic TupleQueryResult listSpinFunctions() throws AGHttpException
TupleQueryResult
a list of defined SPIN magic propertiesAGHttpException
- if there is a problem with the requestpublic void putSpinFunction(AGSpinFunction fn) throws AGHttpException
fn
- the SPIN magic property to addAGHttpException
- if there is a problem with the requestpublic void deleteSpinFunction(String uri) throws AGHttpException
uri
- name of the SPIN magic property to deleteAGHttpException
- if there is a problem with the requestpublic void deleteHardSpinFunction(String uri) throws AGHttpException
uri
- name of the SPIN magic property to deleteAGHttpException
- if there is a problem with the requestpublic String getSpinMagicProperty(String uri) throws AGHttpException
uri
- name of the SPIN magic property to retrieveAGHttpException
- if there is a problem with the requestpublic TupleQueryResult listSpinMagicProperties() throws AGHttpException
TupleQueryResult
a list of defined SPIN magic propertiesAGHttpException
- if there is a problem with the requestpublic void putSpinMagicProperty(AGSpinMagicProperty fn) throws AGHttpException
fn
- the SPIN magic property to addAGHttpException
- if there is a problem with the requestpublic void deleteSpinMagicProperty(String uri) throws AGHttpException
uri
- The uri naming the SPIN magic property to deleteAGHttpException
- if there is a problem with the requestpublic void deleteHardSpinMagicProperty(String uri) throws AGHttpException
uri
- The uri naming the SPIN magic property to deleteAGHttpException
- if there is a problem with the requestpublic boolean getAllowExternalBlankNodeIds()
setAllowExternalBlankNodeIds(boolean)
,
AGValueFactory.isAGBlankNodeId(String)
public void setAllowExternalBlankNodeIds(boolean allow)
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.
allow
- true enables a workaround to support external bnodesgetAllowExternalBlankNodeIds()
,
AGValueFactory.isAGBlankNodeId(String)
public Resource getStorableResource(Resource r, AGValueFactory vf)
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.
r
- a resourcevf
- a value factory that can create new store valuesgetApplicationResource(Resource, AGValueFactory)
,
setAllowExternalBlankNodeIds(boolean)
public Value getStorableValue(Value v, AGValueFactory vf)
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.
v
- a valuevf
- a value factory that can create new store valuesgetApplicationValue(Value, AGValueFactory)
,
setAllowExternalBlankNodeIds(boolean)
public void setMasqueradeAsUser(String user) throws RepositoryException
For AG superusers only. This allows AG superusers to run requests as another user in a dedicated session.
user
- the user for X-Masquerade-As-User requestsRepositoryException
- if an error occurspublic void addAttributeDefinition(String name, List<String> allowedValues, boolean ordered, long minimum, long maximum) throws AGHttpException
name
- the name of the attribute being definedallowedValues
- list of allowed values (null means all values allowed)ordered
- true if allowedValues
are orderedminimum
- the minimum number of times this attribute can be specifiedmaximum
- the maximum number of times this attribute can be specifiedAGHttpException
- if there's a problem with the requestpublic void deleteAttributeDefinition(String name) throws AGHttpException
name
- the attribute to deleteAGHttpException
- if there's a problem with the requestpublic org.json.JSONArray getAttributeDefinition() throws AGHttpException, org.json.JSONException
AGHttpException
- if there's a problem with the requestorg.json.JSONException
- if there's a problem parsing the request into JSONpublic org.json.JSONArray getAttributeDefinition(String name) throws AGHttpException, org.json.JSONException
name
- of the attributeAGHttpException
- if there's a problem with the requestorg.json.JSONException
- if there's a problem parsing the request into JSONpublic String getStaticAttributeFilter() throws AGHttpException
AGHttpException
public void setStaticAttributeFilter(String filter) throws AGHttpException
AGHttpException
public void deleteStaticAttributeFilter() throws AGHttpException
AGHttpException
public boolean getNDGeospatialDatatypeAutomation() throws AGHttpException
AGHttpException
public void enableNDGeospatialDatatypeAutomation() throws AGHttpException
AGHttpException
public void disableNDGeospatialDatatypeAutomation() throws AGHttpException
AGHttpException
public String getUserAttributes()
public void setUserAttributes(String value)
value,
- a String containing a serialized JSON object of the attributespublic TransactionSettings getTransactionSettings()
null
).public void setTransactionSettings(TransactionSettings transactionSettings)
transactionSettings
- New settings or null
, meaning
"use server-chosen defaults for all settings".public void warmup()
warmup(WarmupConfig)
to specify which structures should be read.public void warmup(WarmupConfig config)
config
- Config object that can be used to specify which structures
should be read into memory. If this parameter is null
then the choice will be left to the server.Copyright © 2024 Franz Inc.. All rights reserved.