public class DataCoordinator extends RecordAccessor
The DataCoordinator class is a SemanticAccessor which uses multiple underlying SemanticAccessors. The DataCoordinator maintains a list of which data structures are available in each underlying accessor. When a request is made, the DataCoordinator forwards the request to the underlying SemanticAccessor, and returns the resulting data.
The DataCoordinator differs from the
FusionAccessor
in that the DataCoordinator
simply queries multiple data sources independently of each other, with no
attempt to coordinate the data among the different accessors. The
FusionAccessor attempts to merge the various data sources into a single
source of information.
Constructor and Description |
---|
DataCoordinator() |
Modifier and Type | Method and Description |
---|---|
void |
addAccessor(RecordAccessor accessor)
Add a semantic accessor to this data coordinator.
|
void |
addFieldHandler(java.lang.String fieldName,
FieldHandler handler)
Add a field handler for a particular field.
|
boolean |
extendGraph(java.lang.String graphName,
Graph<DataRecord,DataRecord> graph,
DataRecord node)
Extend the given graph around the specified node.
|
boolean |
extendTree(java.lang.String treeName,
Tree<DataRecord> tree,
DataRecord node)
Extend the given tree around the specified node.
|
java.util.Set<DataRecord> |
getDataset(java.lang.String datasetName)
Retrieve the dataset from the underlying data source.
|
java.util.Set<java.lang.String> |
getDatasetNames()
Get the names of the available datasets from this accessor
|
Graph<DataRecord,DataRecord> |
getGraph(java.lang.String graphName)
Retrieve the graph from the underlying data source.
|
java.util.Set<java.lang.String> |
getGraphNames()
Get the names of the available graphs from this accessor.
|
Grid<DataRecord> |
getGrid(java.lang.String gridName)
Retrieve the grid from the underlying data source.
|
java.util.Set<java.lang.String> |
getGridNames()
Get the names of the available grids from this accessor
|
DataStructureType |
getStructureType(java.lang.String dataName)
Get the data type for the specified dataName.
|
Tree<DataRecord> |
getTree(java.lang.String treeName)
Retrieve the tree from the underlying data source.
|
java.util.Set<java.lang.String> |
getTreeNames()
Get the names of the available trees from this accessor
|
protected java.util.Set<DataRecord> |
retrieveRecords(DataTemplate template)
Retrieve a set of data records for a particular DataTemplate.
|
void |
setInitParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
Set any initialization parameters required by this data accessor.
|
void |
setQuery(java.lang.String query)
Set the query string used to retrieve records.
|
addToGraph, addToTree, createReferenceNode, getFieldHandler, getMaxRecords, getReasoner, getStructureReasoners, setMaxRecords, setReasoner, setReasoner
addStructure, addTemplate, getSpec, getTemplate, getTemplateNames, setConfig, setConfigFile, setConfigFile
public void addAccessor(RecordAccessor accessor)
accessor
- the new accessorpublic void addFieldHandler(java.lang.String fieldName, FieldHandler handler)
addFieldHandler
in class RecordAccessor
fieldName
- the data field within the DataRecordhandler
- the field handlerpublic boolean extendGraph(java.lang.String graphName, Graph<DataRecord,DataRecord> graph, DataRecord node)
extendGraph
in interface DataAccessor<DataRecord,DataRecord>
extendGraph
in class RecordAccessor
graphName
- The name of the graphgraph
- The graph to extendnode
- The node to use as an extension point.public boolean extendTree(java.lang.String treeName, Tree<DataRecord> tree, DataRecord node)
extendTree
in interface DataAccessor<DataRecord,DataRecord>
extendTree
in class RecordAccessor
treeName
- The name of the graphtree
- The graph to extendnode
- The node to use as an extension point.public java.util.Set<DataRecord> getDataset(java.lang.String datasetName)
getDataset
in interface DataAccessor<DataRecord,DataRecord>
getDataset
in class RecordAccessor
datasetName
- the name of the datasetpublic java.util.Set<java.lang.String> getDatasetNames()
getDatasetNames
in interface DataAccessor<DataRecord,DataRecord>
getDatasetNames
in class AbstractDataAccessor<DataRecord,DataRecord>
public Graph<DataRecord,DataRecord> getGraph(java.lang.String graphName)
getGraph
in interface DataAccessor<DataRecord,DataRecord>
getGraph
in class RecordAccessor
graphName
- the name of the graphpublic java.util.Set<java.lang.String> getGraphNames()
getGraphNames
in interface DataAccessor<DataRecord,DataRecord>
getGraphNames
in class AbstractDataAccessor<DataRecord,DataRecord>
public Grid<DataRecord> getGrid(java.lang.String gridName)
getGrid
in interface DataAccessor<DataRecord,DataRecord>
getGrid
in class RecordAccessor
gridName
- the name of the gridpublic java.util.Set<java.lang.String> getGridNames()
getGridNames
in interface DataAccessor<DataRecord,DataRecord>
getGridNames
in class AbstractDataAccessor<DataRecord,DataRecord>
public DataStructureType getStructureType(java.lang.String dataName)
getStructureType
in interface DataAccessor<DataRecord,DataRecord>
getStructureType
in class AbstractDataAccessor<DataRecord,DataRecord>
dataName
- the name of the datapublic Tree<DataRecord> getTree(java.lang.String treeName)
getTree
in interface DataAccessor<DataRecord,DataRecord>
getTree
in class RecordAccessor
treeName
- the name of the treepublic java.util.Set<java.lang.String> getTreeNames()
getTreeNames
in interface DataAccessor<DataRecord,DataRecord>
getTreeNames
in class AbstractDataAccessor<DataRecord,DataRecord>
protected java.util.Set<DataRecord> retrieveRecords(DataTemplate template)
retrieveRecords
in class RecordAccessor
template
- The data template specifying field mappings and
descriptionspublic void setInitParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
parameters
- a map of initialization parameterspublic void setQuery(java.lang.String query)
setQuery
in class AbstractDataAccessor<DataRecord,DataRecord>
query
- the query string