public class Query extends Object
TypedValue
Date
String
UUID
Each bound variable must have a corresponding value in the query string used to create this query.
String query = "[:find ?name ?cat\n" + " :in ?type\n" + " :where\n" + " [?c :community/name ?name]\n" + " [?c :community/type ?type]\n" + " [?c :community/category ?cat]]"; mentat.query(query).bindKeywordReference("?type", ":community.type/website").run(new RelResultHandler() {
Constructor and Description |
---|
Query(JNA.QueryBuilder pointer) |
Modifier and Type | Method and Description |
---|---|
Query |
bind(String varName,
boolean value)
Binds a boolean value to the provided variable name.
|
Query |
bind(String varName,
Date value)
Binds a
Date value to the provided variable name. |
Query |
bind(String varName,
double value)
Binds a double value to the provided variable name.
|
Query |
bind(String varName,
long value)
Binds a long value to the provided variable name.
|
Query |
bind(String varName,
String value)
Binds a
String value to the provided variable name. |
Query |
bind(String varName,
UUID value)
Binds a
UUID value to the provided variable name. |
Query |
bindEntidReference(String varName,
long value)
Binds a Entid value to the provided variable name.
|
Query |
bindKeyword(String varName,
String value)
Binds a keyword value to the provided variable name.
|
Query |
bindKeywordReference(String varName,
String value)
Binds a String keyword value to the provided variable name.
|
void |
close() |
protected void |
destroyPointer(JNA.QueryBuilder p) |
protected void |
finalize() |
void |
run(CollResultHandler handler)
Execute the query with the values bound associated with this
Query and call the provided
callback function with the results with the result as a list of single TypedValue s. |
void |
run(RelResultHandler handler)
Execute the query with the values bound associated with this
Query and call the provided
callback function with the results as a list of rows of TypedValue s. |
void |
run(ScalarResultHandler handler)
Execute the query with the values bound associated with this
Query and call the provided
callback function with the results with the result as a single TypedValue . |
void |
run(TupleResultHandler handler)
Execute the query with the values bound associated with this
Query and call the provided
callback function with the results with the result as a list of single TypedValue s. |
public Query(JNA.QueryBuilder pointer)
public Query bind(String varName, long value)
varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bindEntidReference(String varName, long value)
varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bindKeywordReference(String varName, String value)
varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bindKeyword(String varName, String value)
varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bind(String varName, boolean value)
varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bind(String varName, double value)
varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bind(String varName, Date value)
Date
value to the provided variable name.
TODO: Throw an exception if the query raw pointer has been consumed.varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bind(String varName, String value)
String
value to the provided variable name.
TODO: Throw an exception if the query raw pointer has been consumed.varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public Query bind(String varName, UUID value)
UUID
value to the provided variable name.
TODO: Throw an exception if the query raw pointer has been consumed.varName
- The name of the variable in the format `?name`.value
- The value to be boundQuery
such that further function can be called.public void run(RelResultHandler handler)
Query
and call the provided
callback function with the results as a list of rows of TypedValue
s.
TODO: Throw an exception if the query raw pointer has been consumed or the query fails to executehandler
- the handler to call with the results of this querypublic void run(ScalarResultHandler handler)
Query
and call the provided
callback function with the results with the result as a single TypedValue
.
TODO: Throw an exception if the query raw pointer has been consumed or the query fails to executehandler
- the handler to call with the results of this querypublic void run(CollResultHandler handler)
Query
and call the provided
callback function with the results with the result as a list of single TypedValue
s.
TODO: Throw an exception if the query raw pointer has been consumed or the query fails to executehandler
- the handler to call with the results of this querypublic void run(TupleResultHandler handler)
Query
and call the provided
callback function with the results with the result as a list of single TypedValue
s.
TODO: Throw an exception if the query raw pointer has been consumed or the query fails to executehandler
- the handler to call with the results of this queryprotected void destroyPointer(JNA.QueryBuilder p)
public void close()
close
in interface AutoCloseable