public class DefaultKnowledgeBase extends AbstractProfilable implements KnowledgeBase
Constructor and Description |
---|
DefaultKnowledgeBase(AtomSet store,
Parser<Object> parser)
Constructs a DefaultKnowledgeBase embedding the specified
Store . |
DefaultKnowledgeBase(AtomSet store,
RuleSet ontology)
Constructs a DefaultKnowledgeBase embedding the specified
Store and . |
DefaultKnowledgeBase(Parser<Object> parser)
Constructs a DefaultKnowledgeBase with a
DefaultInMemoryGraphStore as storage. |
Modifier and Type | Method and Description |
---|---|
boolean |
addQuery(Query query) |
protected void |
analyse() |
void |
close() |
protected void |
compileRule() |
protected void |
fesSaturate() |
protected void |
fesSaturate(long timeout)
Run saturation with a timeout at
timeout milliseconds for this thread to die. |
protected void |
finalize() |
Approach |
getApproach()
Returns the defined priority of this KnowledgeBase (ie saturation or
rewriting).
|
protected int[] |
getDecidableCombination() |
AtomSet |
getFacts()
Get the facts attached to this knowledgeBase.
|
protected GraphOfRuleDependencies |
getFESGraphOfRuleDependencies() |
protected RuleSet |
getFESRuleSet() |
protected RuleSet |
getFUSRuleSet() |
RuleSet |
getOntology()
Get the ontology attached to this knowledge base.
|
Query |
getQuery(String name) |
Set<String> |
getQueryNames() |
Rule |
getRule(String name) |
Set<String> |
getRuleNames() |
CloseableIterator<Substitution> |
homomorphism(Query query)
Find an homomorphism of the query in the fact base associated with this
knowledge base.
|
boolean |
isConsistent()
Return true if this knowledge base is consistent, false otherwise.
|
protected void |
load(Parser<Object> parser) |
CloseableIterator<Substitution> |
query(Query query)
Execute the query over this Knowledge Base.
|
CloseableIterator<Substitution> |
query(Query query,
long timeout)
Execute the query over this Knowledge Base.
|
void |
saturate()
Saturate this knowledge base.
|
void |
semiSaturate() |
getProfiler, setProfiler
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProfiler, setProfiler
public DefaultKnowledgeBase(Parser<Object> parser) throws AtomSetException
DefaultInMemoryGraphStore
as storage. Loads rules
and
atoms
from the specified parser.AtomSetException
public DefaultKnowledgeBase(AtomSet store, Parser<Object> parser) throws AtomSetException
Store
.
Loads rules
and supplementary atoms
from the specified
parser.AtomSetException
protected void finalize() throws Throwable
public RuleSet getOntology()
KnowledgeBase
getOntology
in interface KnowledgeBase
public AtomSet getFacts()
KnowledgeBase
getFacts
in interface KnowledgeBase
public boolean isConsistent() throws KnowledgeBaseException
KnowledgeBase
isConsistent
in interface KnowledgeBase
KnowledgeBaseException
public void saturate() throws KnowledgeBaseException
KnowledgeBase
saturate
in interface KnowledgeBase
KnowledgeBaseException
public void semiSaturate() throws KnowledgeBaseException
semiSaturate
in interface KnowledgeBase
KnowledgeBaseException
public CloseableIterator<Substitution> homomorphism(Query query) throws KnowledgeBaseException
KnowledgeBase
homomorphism
in interface KnowledgeBase
KnowledgeBaseException
public CloseableIterator<Substitution> query(Query query) throws KnowledgeBaseException
KnowledgeBase
KnowledgeBase.query(Query,long)
.query
in interface KnowledgeBase
KnowledgeBaseException
public CloseableIterator<Substitution> query(Query query, long timeout) throws KnowledgeBaseException, TimeoutException
KnowledgeBase
TimeoutException
will be throw. Other steps in this method
is not taken into account for the timeout, these other steps can not be
infinite. Approach
is set to REWRITING_ONLY
or
SATURATION_ONLY, the knowledge base decidability analysis
will be bypass.
query
in interface KnowledgeBase
timeout
- in secondsKnowledgeBaseException
TimeoutException
public void close()
close
in interface KnowledgeBase
close
in interface Closeable
close
in interface AutoCloseable
public Set<String> getRuleNames()
getRuleNames
in interface KnowledgeBase
public Rule getRule(String name)
getRule
in interface KnowledgeBase
public boolean addQuery(Query query)
addQuery
in interface KnowledgeBase
public Set<String> getQueryNames()
getQueryNames
in interface KnowledgeBase
public Query getQuery(String name)
getQuery
in interface KnowledgeBase
public Approach getApproach()
KnowledgeBase
getApproach
in interface KnowledgeBase
protected void fesSaturate(long timeout) throws ChaseException, TimeoutException
timeout
milliseconds for this thread to die. A timeout of 0 means to wait forever.timeout
- in millisecondsChaseException
TimeoutException
protected void fesSaturate() throws ChaseException
ChaseException
protected RuleSet getFESRuleSet()
protected RuleSet getFUSRuleSet()
protected GraphOfRuleDependencies getFESGraphOfRuleDependencies()
protected int[] getDecidableCombination()
protected void analyse()
protected void compileRule()
protected void load(Parser<Object> parser) throws AtomSetException
AtomSetException
Copyright © 2014–2018 GraphIK (INRIA - LIRMM). All rights reserved.