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 Details

    • getFacts

      InMemoryAtomSet getFacts()
    • getOntology

      RuleSet getOntology()
      Get the ontology attached to this knowledge base.
      Returns:
      a RuleSet representing the ontology.
    • getRuleNames

      Set<String> getRuleNames()
    • getRule

      Rule getRule(String name)
    • addQuery

      boolean addQuery(Query query)
    • getQueryNames

      Set<String> getQueryNames()
    • getQuery

      Query getQuery(String name)
    • isConsistent

      boolean isConsistent() throws fr.lirmm.graphik.integraal.api.kb.KnowledgeBaseException
      Return 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.KnowledgeBaseException
      Saturate 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, see KnowledgeBase.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 a TimeoutException will be throw. Other steps in this method is not taken into account for the timeout, these other steps can not be infinite.
      If Approach is set to REWRITING_ONLY or SATURATION_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.KnowledgeBaseException
      fr.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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • setProfiler

      void setProfiler(fr.lirmm.graphik.util.profiler.Profiler profiler)
    • getProfiler

      fr.lirmm.graphik.util.profiler.Profiler getProfiler()