public class IndexQueryBuilder extends BaseQuery implements JanusGraphIndexQuery
JanusGraphIndexQuery for string based queries that are issued directly against the specified
indexing backend. It is assumed that the given string conforms to the query language of the indexing backend.
This class does not understand or verify the provided query. However, it will introspect the query and replace
any reference to `v.SOME_KEY`, `e.SOME_KEY` or `p.SOME_KEY` with the respective key reference. This replacement
is 'dumb' in the sense that it relies on simple string replacements to accomplish this. If the key contains special characters
(in particular space) then it must be encapsulated in quotation marks.
In addition to the query string, a number of parameters can be specified which will be passed verbatim to the indexing backend during query execution.
This class essentially just acts as a builder, uses the IndexSerializer to execute the query, and then post-processes
the result set to return to the user.
JanusGraphIndexQuery.Result<V extends org.apache.tinkerpop.gremlin.structure.Element>| Constructor and Description |
|---|
IndexQueryBuilder(StandardJanusGraphTx tx,
IndexSerializer serializer) |
| Modifier and Type | Method and Description |
|---|---|
IndexQueryBuilder |
addParameter(Parameter para)
Adds the given parameter to the list of parameters of this query.
|
IndexQueryBuilder |
addParameters(Iterable<Parameter> paras)
Adds the given parameters to the list of parameters of this query.
|
IndexQueryBuilder |
addParameters(Parameter... paras)
Adds the given parameters to the list of parameters of this query.
|
Stream<JanusGraphIndexQuery.Result<JanusGraphEdge>> |
edgeStream()
Returns all edges that match the query in the indexing backend.
|
Long |
edgeTotals()
Returns total edges that match the query in the indexing backend ignoring limit and offset.
|
String |
getIndex() |
int |
getOffset() |
List<Parameter<org.apache.tinkerpop.gremlin.process.traversal.Order>> |
getOrders() |
Parameter[] |
getParameters() |
String |
getPrefix() |
String |
getQuery() |
String |
getUnknownKeyName() |
IndexQueryBuilder |
limit(int limit)
Specifies the maximum number of elements to return
|
IndexQueryBuilder |
offset(int offset)
Specifies the offset of the query.
|
JanusGraphIndexQuery |
orderBy(String key,
org.apache.tinkerpop.gremlin.process.traversal.Order order)
Orders the element results of this query according
to their property for the given key in the given order (increasing/decreasing).
|
Stream<JanusGraphIndexQuery.Result<JanusGraphVertexProperty>> |
propertyStream()
Returns all properties that match the query in the indexing backend.
|
Long |
propertyTotals()
Returns total properties that match the query in the indexing backend ignoring limit and offset.
|
IndexQueryBuilder |
setElementIdentifier(String identifier)
Sets the element identifier string that is used by this query builder as the token to identifier key references
in the query string.
|
IndexQueryBuilder |
setIndex(String indexName) |
IndexQueryBuilder |
setQuery(String query) |
Stream<JanusGraphIndexQuery.Result<JanusGraphVertex>> |
vertexStream()
Returns all vertices that match the query in the indexing backend.
|
Long |
vertexTotals()
Returns total vertices that match the query in the indexing backend ignoring limit and offset.
|
public IndexQueryBuilder(StandardJanusGraphTx tx, IndexSerializer serializer)
public String getIndex()
public Parameter[] getParameters()
public String getQuery()
public int getOffset()
public String getPrefix()
public IndexQueryBuilder setElementIdentifier(String identifier)
JanusGraphIndexQueryFor example, in the query 'v.name: Tom' the element identifier is 'v.'
setElementIdentifier in interface JanusGraphIndexQueryidentifier - The element identifier which must not be blankpublic String getUnknownKeyName()
public IndexQueryBuilder setIndex(String indexName)
public IndexQueryBuilder setQuery(String query)
public IndexQueryBuilder offset(int offset)
JanusGraphIndexQueryoffset in interface JanusGraphIndexQuerypublic JanusGraphIndexQuery orderBy(String key, org.apache.tinkerpop.gremlin.process.traversal.Order order)
JanusGraphIndexQueryorderBy in interface JanusGraphIndexQuerykey - The key of the properties on which to orderorder - the ordering directionpublic IndexQueryBuilder limit(int limit)
JanusGraphIndexQuerylimit in interface JanusGraphIndexQuerypublic IndexQueryBuilder addParameter(Parameter para)
JanusGraphIndexQueryaddParameter in interface JanusGraphIndexQuerypublic IndexQueryBuilder addParameters(Iterable<Parameter> paras)
JanusGraphIndexQueryaddParameters in interface JanusGraphIndexQuerypublic IndexQueryBuilder addParameters(Parameter... paras)
JanusGraphIndexQueryaddParameters in interface JanusGraphIndexQuerypublic Stream<JanusGraphIndexQuery.Result<JanusGraphVertex>> vertexStream()
JanusGraphIndexQueryvertexStream in interface JanusGraphIndexQuerypublic Stream<JanusGraphIndexQuery.Result<JanusGraphEdge>> edgeStream()
JanusGraphIndexQueryedgeStream in interface JanusGraphIndexQuerypublic Stream<JanusGraphIndexQuery.Result<JanusGraphVertexProperty>> propertyStream()
JanusGraphIndexQuerypropertyStream in interface JanusGraphIndexQuerypublic Long vertexTotals()
JanusGraphIndexQueryvertexTotals in interface JanusGraphIndexQuerypublic Long edgeTotals()
JanusGraphIndexQueryedgeTotals in interface JanusGraphIndexQuerypublic Long propertyTotals()
JanusGraphIndexQuerypropertyTotals in interface JanusGraphIndexQueryCopyright © 2012–2023. All rights reserved.