Package com.complexible.stardog
Interface StoredQuery
-
public interface StoredQueryRepresents a query stored in the server. Stored queries can be executed directly by using their name.Shared queriescan be executed by any user. Private queries can only be executed by theircreatoror super users. Stored queries can be executed over thegetDatabase()database} associated with the query. The special value "*" indicates a query can be executed over any database.- Since:
- 4.2
- Version:
- 4.2
- Author:
- Evren Sirin
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceStoredQuery.BuilderBuilder interface for creating instances of StoredQuery.static classStoredQuery.TriggerPayloadTypeEnum representing the payload type for triggers.static classStoredQuery.TriggerStatus
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringALL_DATABASESSpecial value indicating a stored query can be executed over all databases.static intDEFAULT_TRIGGER_LIMITThe default trigger query result limit to watch.static java.util.regex.PatternVALID_NAME_PATTERNRegex for validating stored query names
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidclose()After this call the query can no longer be used.com.google.common.collect.Multimap<IRI,Value>getAnnotations()Returns the additional annotations associated with the stored query.java.lang.StringgetCreator()Returns the name of the user who stored the query.java.lang.StringgetDatabase()Returns the name of the database for this query.java.lang.StringgetDescription()Returns the description of the stored query.java.lang.StringgetName()Returns the name of the stored query.java.lang.StringgetQuery()Returns the query string.java.lang.StringgetSchema()Returns the reasoning schema that will be used by this query ornull schemaif reasoning is not used.intgetTriggerLimit()Returns the limit on the number of query tuples which will be observerdStoredQuery.TriggerPayloadTypegetTriggerPayloadType()Returns the payload type for the trigger.intgetTriggerSchedule()The frequency at which the query will be executedStoredQuery.TriggerStatusgetTriggerStatus()intgetTriggerTimeout()booleanisAvailable()true, if not closed.booleanisReasoning()Returnstrueif this query is going to be executed with reasoning enabled.booleanisShared()Returnstrueif this query is shared by all the users.booleanisTrigger()Returnstrueif the results of this query are watched by the system, and notifications are sent when the results change.static booleanisValidName(java.lang.String name)Returnstrueif the given name is a valid stored query name.voidsetTriggerStatus(StoredQuery.TriggerStatus status)StoredQuery.BuildertoBuilder()default StoredQuerywithName(java.lang.String theNewName)Creates a copy of this query with a different name.
-
-
-
Field Detail
-
DEFAULT_TRIGGER_LIMIT
static final int DEFAULT_TRIGGER_LIMIT
The default trigger query result limit to watch. If the query does not have an ORDER BY as the top plan node, then we will impose an ordering on the query.- See Also:
- Constant Field Values
-
ALL_DATABASES
static final java.lang.String ALL_DATABASES
Special value indicating a stored query can be executed over all databases.- See Also:
- Constant Field Values
-
VALID_NAME_PATTERN
static final java.util.regex.Pattern VALID_NAME_PATTERN
Regex for validating stored query names
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of the stored query.- Returns:
- the name of the stored query.
-
getDescription
java.lang.String getDescription()
Returns the description of the stored query.- Returns:
- the description of the stored query.
-
getQuery
java.lang.String getQuery()
Returns the query string.- Returns:
- the query string
-
getCreator
java.lang.String getCreator()
Returns the name of the user who stored the query.- Returns:
- the name of the user who stored the query.
-
getDatabase
java.lang.String getDatabase()
Returns the name of the database for this query. The special value "*" can be used to indicate a query can be executed over any database.- Returns:
- the name of the database for this query.
-
isShared
boolean isShared()
Returnstrueif this query is shared by all the users. Shared queries can be executed by any user.- Returns:
trueif this query is shared by all the users
-
isReasoning
boolean isReasoning()
Returnstrueif this query is going to be executed with reasoning enabled.- Returns:
trueif this query is going to be executed with reasoning enabled
-
isTrigger
boolean isTrigger()
Returnstrueif the results of this query are watched by the system, and notifications are sent when the results change.- Returns:
trueif this query is a query trigger
-
getTriggerLimit
int getTriggerLimit()
Returns the limit on the number of query tuples which will be observerd- Returns:
- number of rows
-
getTriggerSchedule
int getTriggerSchedule()
The frequency at which the query will be executed- Returns:
- frequency in milliseconds
-
getTriggerTimeout
int getTriggerTimeout()
- Returns:
- trigger timeout in seconds
-
getSchema
java.lang.String getSchema()
Returns the reasoning schema that will be used by this query ornull schemaif reasoning is not used. If the schema is set to anything other thannullthen that schema wil lbe used for execution regardless of the schema specified for the connection. If the schema is set tonullthen schema settings of the connection will be used for execution.- Returns:
- the name of the reasoning schema
-
getAnnotations
com.google.common.collect.Multimap<IRI,Value> getAnnotations()
Returns the additional annotations associated with the stored query.- Returns:
- the additional annotations associated with the stored query.
-
close
void close()
After this call the query can no longer be used.
-
isAvailable
boolean isAvailable()
true, if not closed.
-
getTriggerStatus
@Nullable StoredQuery.TriggerStatus getTriggerStatus()
- Returns:
- ephemeral trigger status, not immutable
-
setTriggerStatus
void setTriggerStatus(StoredQuery.TriggerStatus status)
- Parameters:
status- to set
-
withName
default StoredQuery withName(java.lang.String theNewName)
Creates a copy of this query with a different name.- Parameters:
theNewName- new name- Returns:
- a query with specified name
-
isValidName
static boolean isValidName(java.lang.String name)
Returnstrueif the given name is a valid stored query name.- Parameters:
name- query name to validate- Returns:
trueif the given name is a valid stored query name.
-
toBuilder
StoredQuery.Builder toBuilder()
- Returns:
- builder object with the contents of this object
-
getTriggerPayloadType
StoredQuery.TriggerPayloadType getTriggerPayloadType()
Returns the payload type for the trigger.- Returns:
- the trigger payload type
-
-