public final class KnowledgeBaseUtils extends Object
KnowledgeBase instances.| Modifier and Type | Field and Description |
|---|---|
static String |
CONJUNCTION_PREDICATE_NAME
The functor of structures representing conjunctions (
,). |
static String |
IMPLICATION_PREDICATE_NAME
The functor of structures representing implications (
:-). |
static String |
QUESTION_PREDICATE_NAME
The functor of structures representing questions (i.e.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
bootstrap(KnowledgeBase kb)
Consults the
ProjogProperties.getBootstrapScript() for the KnowledgeBase. |
static KnowledgeBase |
createKnowledgeBase()
Constructs a new
KnowledgeBase object using ProjogDefaultProperties |
static KnowledgeBase |
createKnowledgeBase(ProjogProperties projogProperties)
Constructs a new
KnowledgeBase object using the specified ProjogProperties |
static List<PredicateKey> |
getPredicateKeysByName(KnowledgeBase kb,
String predicateName)
Returns list of all user defined predicates with the specified name.
|
static <T> T |
instantiate(KnowledgeBase knowledgeBase,
String input)
Returns a new object created using reflection.
|
static boolean |
isConjunction(Term t)
|
static boolean |
isQuestionOrDirectiveFunctionCall(Term t)
|
static boolean |
isSingleAnswer(KnowledgeBase kb,
Term term)
Returns
true if the predicate represented by the specified Term never succeeds on re-evaluation. |
static Term[] |
toArrayOfConjunctions(Term t)
|
public static final String CONJUNCTION_PREDICATE_NAME
,).public static final String IMPLICATION_PREDICATE_NAME
:-).public static final String QUESTION_PREDICATE_NAME
?-).public static KnowledgeBase createKnowledgeBase()
KnowledgeBase object using ProjogDefaultPropertiespublic static KnowledgeBase createKnowledgeBase(ProjogProperties projogProperties)
KnowledgeBase object using the specified ProjogPropertiespublic static void bootstrap(KnowledgeBase kb)
ProjogProperties.getBootstrapScript() for the KnowledgeBase.
This is a way to configure a new KnowledgeBase (i.e. plugging in ArithmeticOperator and
PredicateFactory instances).
When using ProjogDefaultProperties the resource parsed will be projog-bootstrap.pl (contained in
projog-core.jar).
public static List<PredicateKey> getPredicateKeysByName(KnowledgeBase kb, String predicateName)
public static boolean isQuestionOrDirectiveFunctionCall(Term t)
true if the specified Term represents a question or directive, else false.
A Term is judged to represent a question if it is a structure a single argument and with a functor
QUESTION_PREDICATE_NAME or IMPLICATION_PREDICATE_NAME.
public static boolean isSingleAnswer(KnowledgeBase kb, Term term)
true if the predicate represented by the specified Term never succeeds on re-evaluation.public static boolean isConjunction(Term t)
true if the specified Term represent a conjunction, else false.
A Term is judged to represent a conjunction if is a structure with a functor of
CONJUNCTION_PREDICATE_NAME and exactly two arguments.
public static <T> T instantiate(KnowledgeBase knowledgeBase, String input) throws ReflectiveOperationException
The input parameter can be in one of two formats:
java.lang.String - this will cause an attempt to create a new instance of the
specified class using its no argument constructor./) - e.g.
java.util.Calendar/getInstance - this will cause an attempt to create a new instance of the class by
invoking the specified method (as a no argument static method) of the specified class.ReflectiveOperationExceptionCopyright © 2024. All rights reserved.