public class GraphQuery extends Object implements org.plasma.sdo.access.QueryDispatcher
data graphs from HBase
given a PlasmaQuery™ based XPath or DSL query. First an HBase row
filter is assembled using PredicateRowFilterAssembler which uses
query literal values and logic found in the 'where' clause or predicate(s).
Any "slice" of a graph or set of sub-graphs can be selected using the
PlasmaQuery™ API by specifying paths through the graph. Paths may
include any number of predicates along the path. Based on this selection
criteria an GraphFetchColumnFilterAssembler is used to precisely
restrict the HBase columns returned for each result row.
Then for each resulting HBase row, a data graph
assembler is used to
reconstruct and return the original graph structure from the resulting HBase
row.
The PlasmaQuery™ API provides a flexible mechanism to fully describe any arbitrary SDO results Data Graph, independent of any persistence framework or type of data store. PlasmaQueryâ„¢ supports XPath expressions as a free-text "surface language", parsed by the API implementation and used to construct an underlying query object model representation. As an alternative to free-text, PlasmaQueryâ„¢ contains a query Domain Specific Language (DSL) generator and API facilitating (IDE) code-completion, 100% compile-time checking and resulting in code with an almost "fluent" English appearance based on your business model.
Query,
PredicateRowFilterAssembler,
SimpleGraphAssembler,
GraphFetchColumnFilterAssembler| Modifier and Type | Field and Description |
|---|---|
protected ServiceContext |
context |
| Constructor and Description |
|---|
GraphQuery(ServiceContext context) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
canAbortScan(boolean hasOrdering,
Integer startRange,
Integer endRange,
Set<org.plasma.sdo.PlasmaDataGraph> result) |
void |
close() |
protected void |
collectRowKeyProperties(org.plasma.query.collector.SelectionCollector collector,
org.plasma.sdo.PlasmaType type,
ServiceContext context)
Recursively collects row key properties adding them to the given collector
for the given type.
|
int |
count(org.plasma.query.model.Query query)
Returns a count of the given query.
|
protected ResultsAssembler |
createResultsAssembler(org.plasma.query.model.Query query,
org.plasma.query.collector.SelectionCollector selection,
Expr whereSyntaxTree,
ResultsComparator orderingComparator,
ResultsComparator groupingComparator,
Expr havingSyntaxTree,
TableReader rootTableReader,
GraphAssemblerFactory assemblerFactory) |
protected HBaseFilterAssembler |
createRootColumnFilterAssembler(org.plasma.sdo.PlasmaType type,
org.plasma.query.collector.SelectionCollector collector,
ServiceContext context)
Create and add a column filter for the initial column set based on
existence of path predicates in the Select.
|
protected org.apache.hadoop.hbase.client.Scan |
createScan(FuzzyRowKey fuzzyScan,
org.apache.hadoop.hbase.filter.Filter columnFilter) |
protected org.apache.hadoop.hbase.client.Scan |
createScan(PartialRowKey partialRowKey,
org.apache.hadoop.hbase.filter.Filter columnFilter) |
protected void |
execute(CompleteRowKey rowKey,
TableReader rootTableReader,
org.apache.hadoop.hbase.filter.Filter columnFilter,
ResultsAssembler collector) |
protected void |
execute(FuzzyRowKey fuzzyScan,
TableReader rootTableReader,
org.apache.hadoop.hbase.filter.Filter columnFilter,
ResultsAssembler collector) |
protected void |
execute(org.apache.hadoop.hbase.client.Get get,
TableReader rootTableReader,
ResultsAssembler collector) |
protected void |
execute(List<CompleteRowKey> rowKeys,
TableReader rootTableReader,
org.apache.hadoop.hbase.filter.Filter columnFilter,
ResultsAssembler collector) |
protected void |
execute(List<org.apache.hadoop.hbase.client.Get> gets,
TableReader rootTableReader,
ResultsAssembler collector) |
protected void |
execute(PartialRowKey partialRowKey,
TableReader rootTableReader,
org.apache.hadoop.hbase.filter.Filter columnFilter,
ResultsAssembler collector) |
protected org.plasma.sdo.PlasmaDataGraph[] |
execute(org.plasma.query.model.Query query,
org.plasma.sdo.PlasmaType type,
org.plasma.query.collector.SelectionCollector selection,
org.apache.hadoop.hbase.filter.Filter columnFilter,
Expr whereSyntaxTree,
ResultsComparator orderingComparator,
ResultsComparator groupingComparator,
Expr havingSyntaxTree,
List<PartialRowKey> partialScans,
List<FuzzyRowKey> fuzzyScans,
List<CompleteRowKey> completeKeys,
Timestamp snapshotDate) |
protected void |
execute(org.apache.hadoop.hbase.client.Scan scan,
TableReader rootTableReader,
ResultsAssembler collector) |
org.plasma.sdo.PlasmaDataGraph[] |
find(org.plasma.query.model.Query query,
int requestMax,
Timestamp snapshotDate) |
org.plasma.sdo.PlasmaDataGraph[] |
find(org.plasma.query.model.Query query,
Timestamp snapshotDate) |
protected List |
getVariables(org.plasma.query.model.Where where) |
protected void |
log(org.plasma.query.model.Query query) |
protected String |
serializeGraph(commonj.sdo.DataGraph graph) |
protected ServiceContext context
public GraphQuery(ServiceContext context)
public void close()
close in interface org.plasma.sdo.access.QueryDispatcherpublic org.plasma.sdo.PlasmaDataGraph[] find(org.plasma.query.model.Query query,
Timestamp snapshotDate)
find in interface org.plasma.sdo.access.QueryDispatcherpublic org.plasma.sdo.PlasmaDataGraph[] find(org.plasma.query.model.Query query,
int requestMax,
Timestamp snapshotDate)
find in interface org.plasma.sdo.access.QueryDispatcherpublic int count(org.plasma.query.model.Query query)
count in interface org.plasma.sdo.access.QueryDispatcherquery - the queryprotected org.plasma.sdo.PlasmaDataGraph[] execute(org.plasma.query.model.Query query,
org.plasma.sdo.PlasmaType type,
org.plasma.query.collector.SelectionCollector selection,
org.apache.hadoop.hbase.filter.Filter columnFilter,
Expr whereSyntaxTree,
ResultsComparator orderingComparator,
ResultsComparator groupingComparator,
Expr havingSyntaxTree,
List<PartialRowKey> partialScans,
List<FuzzyRowKey> fuzzyScans,
List<CompleteRowKey> completeKeys,
Timestamp snapshotDate)
protected ResultsAssembler createResultsAssembler(org.plasma.query.model.Query query, org.plasma.query.collector.SelectionCollector selection, Expr whereSyntaxTree, ResultsComparator orderingComparator, ResultsComparator groupingComparator, Expr havingSyntaxTree, TableReader rootTableReader, GraphAssemblerFactory assemblerFactory)
protected boolean canAbortScan(boolean hasOrdering,
Integer startRange,
Integer endRange,
Set<org.plasma.sdo.PlasmaDataGraph> result)
protected void execute(PartialRowKey partialRowKey, TableReader rootTableReader, org.apache.hadoop.hbase.filter.Filter columnFilter, ResultsAssembler collector) throws IOException
IOExceptionprotected org.apache.hadoop.hbase.client.Scan createScan(PartialRowKey partialRowKey, org.apache.hadoop.hbase.filter.Filter columnFilter)
protected void execute(CompleteRowKey rowKey, TableReader rootTableReader, org.apache.hadoop.hbase.filter.Filter columnFilter, ResultsAssembler collector) throws IOException
IOExceptionprotected void execute(List<CompleteRowKey> rowKeys, TableReader rootTableReader, org.apache.hadoop.hbase.filter.Filter columnFilter, ResultsAssembler collector) throws IOException
IOExceptionprotected void execute(FuzzyRowKey fuzzyScan, TableReader rootTableReader, org.apache.hadoop.hbase.filter.Filter columnFilter, ResultsAssembler collector) throws IOException
IOExceptionprotected org.apache.hadoop.hbase.client.Scan createScan(FuzzyRowKey fuzzyScan, org.apache.hadoop.hbase.filter.Filter columnFilter) throws IOException
IOExceptionprotected void execute(org.apache.hadoop.hbase.client.Get get,
TableReader rootTableReader,
ResultsAssembler collector)
throws IOException
IOExceptionprotected void execute(List<org.apache.hadoop.hbase.client.Get> gets, TableReader rootTableReader, ResultsAssembler collector) throws IOException
IOExceptionprotected void execute(org.apache.hadoop.hbase.client.Scan scan,
TableReader rootTableReader,
ResultsAssembler collector)
throws IOException
IOExceptionprotected HBaseFilterAssembler createRootColumnFilterAssembler(org.plasma.sdo.PlasmaType type, org.plasma.query.collector.SelectionCollector collector, ServiceContext context)
GraphFetchColumnFilterAssembler is create. Otherwise
a (@link InitialFetchColumnFilterAssembler) is used to populate the
root(s), and then subsequent fetches are used as directed within the graph
assembler facilitated by the path predicates.type - the root typecollector - the selection collectorGraphFetchColumnFilterAssembler,
InitialFetchColumnFilterAssemblerprotected void collectRowKeyProperties(org.plasma.query.collector.SelectionCollector collector,
org.plasma.sdo.PlasmaType type,
ServiceContext context)
collector - the property collectortype - the current typeprotected List getVariables(org.plasma.query.model.Where where)
protected void log(org.plasma.query.model.Query query)
protected String serializeGraph(commonj.sdo.DataGraph graph) throws IOException
IOExceptionCopyright © 2021. All Rights Reserved.