Prajna includes several different types of components for automated reasoning. Prajna's Automated Reasoning components provide a variety of approaches for deriving and enhancing content on records, data structures, and documents.
Example implementations for many of these reasoning components may be found in the extensions source tree, or in the prajna demonstrations.
Field Handlers work with Semantic Accessors to enhance the data within a particular record when the accessor loads that record. Field Handlers trigger on (and operate on) a particular field within a DataRecord. When the record is loaded, a semantic accessor triggers the field handlers for any particular field when that field has a value.
Field handlers are useful when a particular field needs to be formatted. For instance, a field handler for a text field might look for temporal terms, e.g., "Yesterday". Then the field handler could enhance the data record by adding the actual date. Other examples might be a location field handler which determines a country from a city name, or a time field handler which indicates when an event occurs outside of an expected time window.
Data Filters provide a simple, consistent interface to filter a set of DataRecords. The DataFilter interface allows a developer to implement a particular filter that accepts DataRecord objects based upon particular criteria. One DataFilter might accept only those records which have a particular field set. Another DataFilter might accept those records which have a time field with values within a certain time span.
The TimeSpanFilter is an implementation of a DataFilter which filters records based upon a particular time field within the DataRecord.
The DocFilter interface extends the capabilities of the DataFilter interface to include DocData objects. A DocFilter can include a tag, which is added to the tags of a DocData object when the object matches the filter. The DocFilter object also forms the basis of Prajna's set of Query Filter objects. These query objects enable a developer to build complex query trees. A QueryParser class transforms a formal query syntax into these query filters.
The GuiDataFilter extends the DataFilter by adding a graphical user interface component. This enables a GUI to incorporate a DataFilter which changes its filtering parameters dynamically, such as when a user selects or manipulates the GUI component. The GuiDataFilter sends events when a user makes such a change, so the application might refilter the set of records being processed or displayed.
The SemanticReasoner interface provides a very generalized interface for augmenting DataRecords. This interface provides the basis for most of Prajna's automated reasoning components.
The FilterReasoner class enables a developer to quickly build or customize a semantic reasoner. It uses a DataFilter to match when a record should be enhanced. The FilterReasoner includes values that should augment or replace particular fields in the DataRecord when the DataFilter matches the record.
The LocatorReasoner class is a particular type of SemanticReasoner which uses a GeoLocator to add content based on geographic entities.
Entity Extractors and Ontology Reasoners both extend the SemanticReasoner interface.
Prajna includes an abstract EntityExtractor class to support entity extraction. This class supports typed entity extraction, where the extractor identifies the terms and their types (e.g, John Doe is a Person). It supports extraction on files, blocks of text, DocData objects, or streams.
The EntityExtractor class extends the SemanticReasoner interface, so it also can be used to extract information and enhance the fields of a DataRecord.