public class OntologyFilter extends CasaQueryFilter
Modifier and Type | Class and Description |
---|---|
(package private) class |
OntologyFilter.Predicate
A simple class to store the data about a predicate
|
(package private) static class |
OntologyFilter.PredType
A simple enum to identify the various types of predicates that we handle.
|
Modifier and Type | Field and Description |
---|---|
private Formula |
pattern0
Pattern that must match to apply the filter
|
private Formula |
pattern1 |
private Formula |
pattern2 |
private Formula |
pattern3 |
private Formula |
patternB0 |
private Formula |
patternB1 |
private Formula |
patternB2 |
private Formula |
patternB3 |
(package private) OntologyFilter.PredType |
predType |
Constructor and Description |
---|
OntologyFilter()
Creates a new OntologyFilter on the different patterns
|
Modifier and Type | Method and Description |
---|---|
QueryResult |
apply(Formula formula,
ArrayList falsityReasons,
QueryResult.BoolWrapper goOn)
Returns a
QueryResult object, similar to the one returned by the query
operation of the KBase interface. |
boolean |
getObserverTriggerPatterns(Formula formula,
Set set)
Fills the set given in parameter with the patterns manipulated by this
filter and likely to trigger the observers which observe the formula given
in parameter.
|
private Set<String> |
getPermutations(Set<String> a,
Set<String> b) |
Set<String> |
recursiveChild(TransientAgent agent,
String x) |
Set<String> |
recursiveParent(TransientAgent agent,
String x) |
Set<String> |
recursivePermutations(List<Set<String>> sets) |
QueryResult |
searchOntology(OntologyFilter.Predicate predicate)
This function generated all possible queries form an query using
agent's ontology and outputs the QueryResult
|
getFormula, getNode, getSymbol, getTerm, getVariable
toStrings
getMyKBase, setMyKBase
private Formula pattern0
private Formula pattern1
private Formula pattern2
private Formula pattern3
private Formula patternB0
private Formula patternB1
private Formula patternB2
private Formula patternB3
OntologyFilter.PredType predType
public OntologyFilter()
public QueryResult apply(Formula formula, ArrayList falsityReasons, QueryResult.BoolWrapper goOn)
KBQueryFilter
QueryResult
object, similar to the one returned by the query
operation of the KBase
interface. Such an objet can be
- QueryResult.UNKNOWN
if the filter is not applicable or
returns no solution,
- QueryResult.KNOWN
if the filter returns
a solution and the formula holds no meta-variable,
- a not empty QueryResult
object if the filter returns
solutions and the formula holds meta-variables.apply
in class KBQueryFilter
formula
- falsityReasons
- goOn
- The formula is matched against the patterns and then an appropriate predicate is generated
to apply the searching against.
public boolean getObserverTriggerPatterns(Formula formula, Set set)
KBQueryFilter
getObserverTriggerPatterns
in class KBQueryFilter
formula
- an observed formulaset
- set of patterns. Each pattern corresponds to a kind a formula
which, if it is asserted in the base, triggers the observer that
observes the formula given in parameter.public Set<String> recursiveChild(TransientAgent agent, String x)
agent
- x
- public Set<String> recursiveParent(TransientAgent agent, String x)
agent
- x
- public QueryResult searchOntology(OntologyFilter.Predicate predicate)
predicate
- public Set<String> recursivePermutations(List<Set<String>> sets)
sets
-