Interface InMemoryKnowledgeBase
- All Superinterfaces:
AutoCloseable, Closeable
public interface InMemoryKnowledgeBase
Knowledge base whose fact base is stored fully in memory.
- Author:
- Clément Sipieter (INRIA) <clement@6pi.fr>
-
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclose()fr.lirmm.graphik.integraal.api.kb.ApproachReturns the defined priority of this KnowledgeBase (ie saturation or rewriting).getFacts()Get the ontology attached to this knowledge base.fr.lirmm.graphik.util.profiler.Profilerhomomorphism(Query query) Find an homomorphism of the query in the fact base associated with this knowledge base.booleanReturn true if this knowledge base is consistent, false otherwise.Execute the query over this Knowledge Base.Execute the query over this Knowledge Base.voidsaturate()Saturate this knowledge base.voidvoidsetProfiler(fr.lirmm.graphik.util.profiler.Profiler profiler)
-
Method Details
-
getFacts
InMemoryAtomSet getFacts() -
getOntology
RuleSet getOntology()Get the ontology attached to this knowledge base.- Returns:
- a RuleSet representing the ontology.
-
getRuleNames
-
getRule
-
addQuery
-
getQueryNames
-
getQuery
-
isConsistent
boolean isConsistent() throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseExceptionReturn true if this knowledge base is consistent, false otherwise.- Returns:
- true if this knowledge base is consistent, false otherwise.
- Throws:
fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException
-
saturate
void saturate() throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseExceptionSaturate this knowledge base.- Throws:
fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException
-
homomorphism
CloseableIterator<Substitution> homomorphism(Query query) throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException Find an homomorphism of the query in the fact base associated with this knowledge base.- Parameters:
query-- Returns:
- An iterator over substitutions which represents founded homomorphisms.
- Throws:
fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException
-
query
CloseableIterator<Substitution> query(Query query) throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException Execute the query over this Knowledge Base. This method uses the graal-rules-analyser module (Kiabora) to find a decidable way to answer, if there are no proof of decidability an KnowledgeBaseException is throw. To disable decidability checking, seeKnowledgeBase.query(fr.lirmm.graphik.integraal.api.core.Query,long).- Parameters:
query-- Returns:
- an Iterator over Substitutions representing homomorphism found of q.
- Throws:
fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException
-
query
CloseableIterator<Substitution> query(Query query, long timeout) throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException, fr.lirmm.graphik.integraal.api.util.TimeoutException Execute the query over this Knowledge Base. This method uses the graal-rules-analyser module (Kiabora) to find a decidable way to answer. If the saturation step plus the rewriting step execution time exceed the specified timeout (in milliseconds) then the method will be interrupted and aTimeoutExceptionwill be throw. Other steps in this method is not taken into account for the timeout, these other steps can not be infinite.
IfApproachis set toREWRITING_ONLYorSATURATION_ONLY, the knowledge base decidability analysis will be bypass.- Parameters:
query-timeout- in milliseconds- Returns:
- an Iterator over Substitutions representing homomorphism found of q.
- Throws:
fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseExceptionfr.lirmm.graphik.integraal.api.util.TimeoutException
-
semiSaturate
void semiSaturate() throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException- Throws:
fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException
-
getApproach
fr.lirmm.graphik.integraal.api.kb.Approach getApproach()Returns the defined priority of this KnowledgeBase (ie saturation or rewriting).- Returns:
- the defined priority of this KnowledgeBase.
-
close
void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
setProfiler
void setProfiler(fr.lirmm.graphik.util.profiler.Profiler profiler) -
getProfiler
fr.lirmm.graphik.util.profiler.Profiler getProfiler()
-