public class Predicates extends Object
Constructor and Description |
---|
Predicates(KnowledgeBase kb) |
Modifier and Type | Method and Description |
---|---|
void |
addPredicateFactory(PredicateKey key,
PredicateFactory predicateFactory)
Associates a
PredicateFactory with this KnowledgeBase . |
void |
addPredicateFactory(PredicateKey key,
String predicateFactoryClassName)
Associates a
PredicateFactory with this KnowledgeBase . |
void |
addUserDefinedPredicate(UserDefinedPredicateFactory userDefinedPredicate)
Adds a user defined predicate to this object.
|
UserDefinedPredicateFactory |
createOrReturnUserDefinedPredicate(PredicateKey key)
Returns the
UserDefinedPredicateFactory for the specified PredicateKey . |
Set<PredicateKey> |
getAllDefinedPredicateKeys()
Returns details of all predicates, both user-defined and built-in predicates.
|
Predicate |
getPredicate(Term t) |
PredicateFactory |
getPredicateFactory(PredicateKey key)
Returns the
PredicateFactory associated with the specified PredicateKey . |
PredicateFactory |
getPredicateFactory(Term term)
Returns the
PredicateFactory associated with the specified Term . |
PredicateFactory |
getPreprocessedPredicateFactory(Term term) |
Map<PredicateKey,UserDefinedPredicateFactory> |
getUserDefinedPredicates()
Returns details of all the user define predicates of this object.
|
public Predicates(KnowledgeBase kb)
public Set<PredicateKey> getAllDefinedPredicateKeys()
public Map<PredicateKey,UserDefinedPredicateFactory> getUserDefinedPredicates()
public UserDefinedPredicateFactory createOrReturnUserDefinedPredicate(PredicateKey key)
UserDefinedPredicateFactory
for the specified PredicateKey
.
If this object does not already have a UserDefinedPredicateFactory
for the specified PredicateKey
then it will create it.
ProjogException
- if the specified PredicateKey
represents an existing "plugin" predicatepublic void addUserDefinedPredicate(UserDefinedPredicateFactory userDefinedPredicate)
Any existing UserDefinedPredicateFactory
with the same PredicateKey
will be replaced.
ProjogException
- if the PredicateKey
of the specified UserDefinedPredicateFactory
represents an existing "plugin" predicatepublic PredicateFactory getPreprocessedPredicateFactory(Term term)
public PredicateFactory getPredicateFactory(Term term)
PredicateFactory
associated with the specified Term
.
If this object has no PredicateFactory
associated with the PredicateKey
of the specified
Term
then a new instance of UnknownPredicate
is returned.
public PredicateFactory getPredicateFactory(PredicateKey key)
PredicateFactory
associated with the specified PredicateKey
.
If this object has no PredicateFactory
associated with the specified PredicateKey
then a new
instance of UnknownPredicate
is returned.
public void addPredicateFactory(PredicateKey key, String predicateFactoryClassName)
PredicateFactory
with this KnowledgeBase
.
This method provides a mechanism for "plugging in" or "injecting" implementations of PredicateFactory
at
runtime. This mechanism provides an easy way to configure and extend the functionality of Projog - including
adding functionality not possible to define in pure Prolog syntax.
key
- The name and arity to associate the PredicateFactory
with.predicateFactoryClassName
- The name of a class that implements PredicateFactory
.ProjogException
- if there is already a PredicateFactory
associated with the PredicateKey
public void addPredicateFactory(PredicateKey key, PredicateFactory predicateFactory)
PredicateFactory
with this KnowledgeBase
.
This method provides a mechanism for "plugging in" or "injecting" implementations of PredicateFactory
at
runtime. This mechanism provides an easy way to configure and extend the functionality of Projog - including
adding functionality not possible to define in pure Prolog syntax.
key
- The name and arity to associate the PredicateFactory
with.predicateFactory
- The PredicateFactory
to be added.ProjogException
- if there is already a PredicateFactory
associated with the PredicateKey
Copyright © 2024. All rights reserved.