| java.lang.Object org.mandarax.kernel.LObject org.mandarax.kernel.LogicFactory
All known Subclasses: org.mandarax.reference.DefaultLogicFactory,
LogicFactory | abstract public class LogicFactory extends LObject (Code) | | Abstract factory object for creating logical entities such as rules, facts and terms.
The implementing classes should never be instanciated
directly. Instead use instances of this class to create them.
Support for obtaining a reference to a default logic factory is provided -
use the static method getDefaultFactory() to obtain a reference.
Note that be default we try to initialize the default factory with an instance of
the subclass org.mandarax.reference.DefaultLogicFactory . The respective
refernce is obtained using Class.forName() so that this package does
only have a weak dependency to the org.mandarax.reference package.
As from 1.9, queries are supported.
See Also: org.mandarax.reference.DefaultLogicFactory author: Jens Dietrich version: 3.4 <7 March 05> since: 1.1 |
Method Summary | |
abstract public ComplexTerm | createComplexTerm(Function aFunction, Term[] terms) Create a new complex term. | abstract public ConstantTerm | createConstantTerm(Object obj) Create a new constant term. | abstract public ConstantTerm | createConstantTerm(Object obj, Class type) Create a new constant term.
a new constant term Parameters: obj - the wrapped object Parameters: type - the type of the object throws an IllegalArgumentException if object and type are inconsistent,i.e. | abstract public Prerequisite | createCut() Create a cut prerequisite. | abstract public Fact | createFact(Predicate aPredicate, Term[] terms) Create a new fact. | abstract public Prerequisite | createPrerequisite(Predicate aPredicate, Term[] terms, boolean negatedAF) Create a new prerequisite. | abstract public Query | createQuery(Fact fact, String name) Create a new query. | abstract public Query | createQuery(Fact[] facts, String name) Create a new query. | abstract public Rule | createRule(java.util.List body, Fact head) Create a new rule. | abstract public Rule | createRule(java.util.List body, Fact head, boolean or) Create a new rule. | public Rule | createRule(Fact head) Create a new rule with an empty body. | abstract public TestCase | createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, boolean expectedResult) Create a new test case. | abstract public TestCase | createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, int expectedNumberOfResults) Create a new test case. | abstract public TestCase | createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, Map[] expectedReplacements) Create a new test case. | abstract public TestCase | createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, int expectedNumberOfResults, boolean expectedResult, Map[] expectedReplacements) Create a new test case.
Note that the parameters are somehow redundant, expectedResult only makes sense if the query is ground while
expectedReplacements only makes sense if the query contains variables. | abstract public VariableTerm | createVariableTerm(String aName, Class aType) Create a new variable term. | abstract public Class | getComplexTermImplementationClass() Return the implementation class for complex terms. | abstract public Class | getConstantTermImplementationClass() Return the implementation class for constant terms. | public static LogicFactory | getDefaultFactory() Get the default factory. | abstract public Class | getFactImplementationClass() Return the implementation class for facts. | abstract public Class | getPrerequisiteImplementationClass() Return the implementation class for prerequisites. | abstract public Class | getQueryImplementationClass() Return the implementation class for queries. | abstract public Class | getRuleImplementationClass() Return the implementation class for rules. | abstract public Class | getVariableTermImplementationClass() Return the implementation class for variable terms. | public void | install() Install the object to become the default factory. |
LogicFactory | public LogicFactory()(Code) | | Constructor.
|
createComplexTerm | abstract public ComplexTerm createComplexTerm(Function aFunction, Term[] terms)(Code) | | Create a new complex term.
a new complex term Parameters: aFunction - a function Parameters: terms - an array of terms |
createConstantTerm | abstract public ConstantTerm createConstantTerm(Object obj)(Code) | | Create a new constant term.
a new constant term Parameters: obj - the wrapped object |
createConstantTerm | abstract public ConstantTerm createConstantTerm(Object obj, Class type)(Code) | | Create a new constant term.
a new constant term Parameters: obj - the wrapped object Parameters: type - the type of the object throws an IllegalArgumentException if object and type are inconsistent,i.e. if type object is not an instance of type |
createCut | abstract public Prerequisite createCut()(Code) | | Create a cut prerequisite.
a prerequisite |
createFact | abstract public Fact createFact(Predicate aPredicate, Term[] terms)(Code) | | Create a new fact.
a new fact Parameters: aPredicate - a predicate Parameters: terms - an array of terms |
createPrerequisite | abstract public Prerequisite createPrerequisite(Predicate aPredicate, Term[] terms, boolean negatedAF)(Code) | | Create a new prerequisite.
a new prerequisite Parameters: aPredicate - a predicate Parameters: terms - an array of terms Parameters: negatedAF - whether the prerequisite is negated (as failure) |
createQuery | abstract public Query createQuery(Fact fact, String name)(Code) | | Create a new query.
a new query Parameters: fact - aFact Parameters: name - the name of the query |
createQuery | abstract public Query createQuery(Fact[] facts, String name)(Code) | | Create a new query.
a new query Parameters: facts - an array of facts Parameters: name - the name of the query |
createRule | abstract public Rule createRule(java.util.List body, Fact head)(Code) | | Create a new rule.
a new rule Parameters: body - a list of prerequisites Parameters: head - the head of the rule |
createRule | abstract public Rule createRule(java.util.List body, Fact head, boolean or)(Code) | | Create a new rule.
a new rule Parameters: body - a list of prerequisites Parameters: head - the head of the rule Parameters: or - indicates whether the prerequisites are connected by OR |
createRule | public Rule createRule(Fact head)(Code) | | Create a new rule with an empty body.
a new rule Parameters: head - a fact that becomes the head of the created rule |
createTestCase | abstract public TestCase createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, boolean expectedResult)(Code) | | Create a new test case.
a new test case Parameters: aQuery - a ground query Parameters: assumptions - some assumptions Parameters: policyToAddAssumptionsToKB - one of the integers in TestCase (TestCase.ON_TOP, TestCase.AT_BOTTOM) Parameters: expectedResult - true or false See Also: org.mandarax.kernel.validation.TestCase |
createTestCase | abstract public TestCase createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, int expectedNumberOfResults)(Code) | | Create a new test case.
a new test case Parameters: aQuery - a ground query Parameters: assumptions - some assumptions Parameters: policyToAddAssumptionsToKB - one of the integers in TestCase (TestCase.ON_TOP, TestCase.AT_BOTTOM) Parameters: expectedNumberOfResults - the expected number of results |
createTestCase | abstract public TestCase createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, Map[] expectedReplacements)(Code) | | Create a new test case.
a new test case Parameters: aQuery - a ground query Parameters: assumptions - some assumptions Parameters: policyToAddAssumptionsToKB - one of the integers in TestCase (TestCase.ON_TOP, TestCase.AT_BOTTOM) Parameters: expectedReplacements - an array of expected replacements, each map contains VariableTerm -> Object associations |
createTestCase | abstract public TestCase createTestCase(Query aQuery, ClauseSet[] assumptions, int policyToAddAssumptionsToKB, int expectedNumberOfResults, boolean expectedResult, Map[] expectedReplacements)(Code) | | Create a new test case.
Note that the parameters are somehow redundant, expectedResult only makes sense if the query is ground while
expectedReplacements only makes sense if the query contains variables. This is a general purpose
creator that can be used in modules such as ZKB.
a new test case Parameters: aQuery - a ground query Parameters: assumptions - some assumptions Parameters: policyToAddAssumptionsToKB - one of the integers in TestCase (TestCase.ON_TOP, TestCase.AT_BOTTOM) Parameters: expectedNumberOfResults - the expected number of results Parameters: expectedResult - true or false Parameters: expectedReplacements - an array of expected replacements, each map contains VariableTerm -> Object associations |
createVariableTerm | abstract public VariableTerm createVariableTerm(String aName, Class aType)(Code) | | Create a new variable term.
a new variable term Parameters: aName - the name of the term Parameters: aType - the type of the term |
getComplexTermImplementationClass | abstract public Class getComplexTermImplementationClass()(Code) | | Return the implementation class for complex terms.
a class |
getConstantTermImplementationClass | abstract public Class getConstantTermImplementationClass()(Code) | | Return the implementation class for constant terms.
a class |
getDefaultFactory | public static LogicFactory getDefaultFactory()(Code) | | Get the default factory.
the default factory object |
getFactImplementationClass | abstract public Class getFactImplementationClass()(Code) | | Return the implementation class for facts.
a class |
getPrerequisiteImplementationClass | abstract public Class getPrerequisiteImplementationClass()(Code) | | Return the implementation class for prerequisites.
a class |
getQueryImplementationClass | abstract public Class getQueryImplementationClass()(Code) | | Return the implementation class for queries.
a class |
getRuleImplementationClass | abstract public Class getRuleImplementationClass()(Code) | | Return the implementation class for rules.
a class |
getVariableTermImplementationClass | abstract public Class getVariableTermImplementationClass()(Code) | | Return the implementation class for variable terms.
a class |
install | public void install()(Code) | | Install the object to become the default factory.
|
|
|