DataAccessors are classes which access data from a variety of data sources and format them into trees, graphs or grids. They can provide data to visualization applications. Each DataAccessor generates a particular base object for its data.
Each dataset, graph, grid, or tree has a name. The DataAccessor uses these names to retrieve a particular data structure. Methods on the DataAccessor interface include retrieving a particular data structure by name and retrieving the names of the data structures. In addition, the interface includes methods to extend a graph or tree, so that a particular accessor can return a small part of a larger structure, and allow interactive exploration.
The SemanticAccessor abstract class is an abstract implementation of a DataAccessor which uses DataRecords as the base object. Since the DataRecord object was designed to represent a wide variety of data, the SemanticAccessor classes can be used for most visualization applications. Prajna includes SemanticAccessors for JDBC, Solr, and several other data formats and sources.
The SemanticAccessor class provides a mapping of source data fields to the fields within a DataRecord. A data source may have fields defined in a schema which is not particularly comprehensible to a casual user. The mapping allows a SemanticAccessor to create DataRecords with fields which are understandable to a human. Furthermore, it allows fusing or merging records from several different data sources into a common representation.
When retrieving data, a SemanticAccessor will load fields into the DataRecord appropriately. However, some applications may require additional transformations of the data, extracting particular elements of a field for other tasks. The FieldHandler interface provides this capability.
For instance, one field in a record might be City Name. However, the latitude and longitude of the city are not included in the record, but the application requires it. A developer can write a FieldHandler which triggers whenever the City Name field is assigned in a DataRecord. The FieldHandler could then perform a lookup to determine the geographic coordinates of the city and store it in the DataRecord.
The FieldHandler is keyed on the name of the field within the DataRecord, not the source field name in the original data source. Therefore, a single FieldHandler may trigger for data from multiple data sources which have a similar field mapping.
The SemanticAccessors use several types of support classes. Each of these classes corresponds to a particular step in the transformation process.
Field Descriptors describe particular fields within the DataRecords that are generated. They extend the abstract class FieldDesc, and there is one field descriptor class for each field type in a DataRecord. The field descriptors indicate the mapping from the source data fields to the DataRecord fields. They may also specify any value limits on the values for a particular field, and the format of the source field, such as how a date is specified.
The DataTemplate class assembles the various field descriptors into a group of fields for a DataRecord. Multiple DataTemplates may be specified for a particular SemanticAccessor, and a particular data structure may use one or multiple DataTemplates for representing its data objects. A particular accessor might have information in several different tables which needs to be fused in a visualization. Each of these tables might correspond to a DataTemplate.
Data structure specifications extends the abstract class DataStructureSpec. Each of the data structure specifications provides the information necessary to generate a particular data structure. They specify which of the various DataTemplates are used for a particular data structure. The specification classes also specify structure-specific information.