fr.lirmm.graphik.cogui.core.model
Class KnowledgeBase

java.lang.Object
  extended by fr.lirmm.graphik.cogui.core.model.KnowledgeBase

public class KnowledgeBase
extends java.lang.Object

The Class KnowledgeBase.


Constructor Summary
KnowledgeBase(Vocabulary voc)
          Instantiates a new knowledge base.
 
Method Summary
 void addDefaultRule(Rule rule)
           
 void addGraph(CGraph graph)
          Adds the graph.
 void addPConstraint(Rule pconst)
           
 void addRTScript(Script script)
           
 void addRule(Rule rule)
          Adds the rule.
 void addScript(Script script)
          Adds the script.
 void cleanUndefTypes()
          resolve undefined types and remove all undefined types that are not used
 void clear()
          Clear.
 boolean delete(CgObject cog)
          Delete.
 Rule getDefaultRule(java.lang.String idr)
           
 RuleSet getDefaultRuleSet()
           
 CGraph getFactGraph(java.lang.String idg)
          Gets the fact graph.
 GraphSet getFactGraphSet()
          Gets the fact graph set.
 GraphSet getGraphSetOf(CGraph graph)
          Gets the graph set of.
 CGraph getIndividualGraph(java.lang.String idg)
          Gets the individual graph.
 GraphSet getIndividualGraphSet()
          Gets the individual graph set.
 GraphSet getNConstraintGraphSet()
           
 CGraph getNegativeConstraint(java.lang.String idg)
           
 java.lang.String getNS(java.lang.String prefix)
           
 CGraph getOtherGraph(java.lang.String idg)
          Gets the other graph.
 GraphSet getOtherGraphSet()
          Gets the other graph set.
 CGraph getPatternGraph(java.lang.String idg)
          Gets the pattern graph.
 GraphSet getPatternGraphSet()
          Gets the pattern graph set.
 java.util.ArrayList<CGraph> getPatterns(java.lang.String type)
          Gets the patterns.
 RuleSet getPConstraintGraphSet()
           
 Rule getPositiveConstraint(java.lang.String idg)
           
 java.lang.String getPrefixOf(java.lang.String id)
           
 CGraph getPrototypicGraph(java.lang.String idg)
          Gets the prototypic graph.
 GraphSet getPrototypicGraphSet()
          Gets the prototypic graph set.
 CGraph getQueryGraph(java.lang.String idg)
          Gets the query graph.
 GraphSet getQueryGraphSet()
          Gets the query graph set.
 Script getRTScript(java.lang.String id)
           
 java.util.Map<java.lang.String,Script> getRTScriptMap()
           
 java.util.Collection<Script> getRTScripts()
           
 Rule getRule(java.lang.String idr)
          Gets the rule.
 RuleSet getRuleSet()
          Gets the rule set.
 Script getScript(java.lang.String id)
          Gets the script.
 java.util.Collection<Script> getScripts()
          Gets the collection of all scripts.
 Vocabulary getVocabulary()
          Gets the vocabulary.
 java.util.Iterator<CGraph> IteratorDefaultRules()
           
 java.util.Iterator<CGraph> iteratorFacts()
          Iterator for facts.
 java.util.Iterator<GraphSet> iteratorGraphSet()
           
 java.util.Iterator<CGraph> IteratorNConstraints()
           
 java.util.Iterator<java.lang.String> iteratorNSPrefix()
          a sorted iterator for declared prefixes
 java.util.Iterator<CGraph> iteratorPatterns()
          Iterator patterns.
 java.util.Iterator<CGraph> IteratorPConstraints()
           
 java.util.Iterator<CGraph> iteratorQueries()
          Iterator for queries.
 java.util.Iterator<CGraph> IteratorRules()
          Iterator rules.
 void removeAllNS()
           
 void removeNS(java.lang.String prefix)
           
 void removeRTScript(java.lang.String id)
           
 void removeScript(java.lang.String id)
           
 int removeUnusedIndividuals()
           
 Rule searchDefaultRuleByLabel(java.lang.String ruleLabel)
           
 GraphSet searchGraphSetByLabel(java.lang.String graphLabel)
           
 GraphSet searchGraphSetOf(java.lang.String graphId)
          Search graph set of.
 Rule searchRuleByLabel(java.lang.String ruleLabel)
           
 Script searchScriptByLabel(java.lang.String name)
           
 Script searchScriptByLabel(java.lang.String name, java.lang.String setName)
           
 void setNameSpace(java.lang.String prefix, java.lang.String ns)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KnowledgeBase

public KnowledgeBase(Vocabulary voc)
Instantiates a new knowledge base.

Parameters:
voc - the voc
Method Detail

getNS

public java.lang.String getNS(java.lang.String prefix)

getPrefixOf

public java.lang.String getPrefixOf(java.lang.String id)

setNameSpace

public void setNameSpace(java.lang.String prefix,
                         java.lang.String ns)

iteratorNSPrefix

public java.util.Iterator<java.lang.String> iteratorNSPrefix()
a sorted iterator for declared prefixes


removeNS

public void removeNS(java.lang.String prefix)

removeAllNS

public void removeAllNS()

getVocabulary

public Vocabulary getVocabulary()
Gets the vocabulary.

Returns:
the vocabulary

clear

public void clear()
Clear.


addGraph

public void addGraph(CGraph graph)
Adds the graph.

Parameters:
graph - the graph

getGraphSetOf

public GraphSet getGraphSetOf(CGraph graph)
Gets the graph set of.

Parameters:
graph - the graph
Returns:
the graph set of

searchRuleByLabel

public Rule searchRuleByLabel(java.lang.String ruleLabel)

searchDefaultRuleByLabel

public Rule searchDefaultRuleByLabel(java.lang.String ruleLabel)

searchScriptByLabel

public Script searchScriptByLabel(java.lang.String name)

searchScriptByLabel

public Script searchScriptByLabel(java.lang.String name,
                                  java.lang.String setName)

searchGraphSetOf

public GraphSet searchGraphSetOf(java.lang.String graphId)
Search graph set of.

Parameters:
graphId - the graph id
Returns:
the graph set

searchGraphSetByLabel

public GraphSet searchGraphSetByLabel(java.lang.String graphLabel)

addRule

public void addRule(Rule rule)
Adds the rule.

Parameters:
rule - the rule

addDefaultRule

public void addDefaultRule(Rule rule)

addPConstraint

public void addPConstraint(Rule pconst)

getFactGraph

public CGraph getFactGraph(java.lang.String idg)
Gets the fact graph.

Parameters:
idg - the idg
Returns:
the fact graph

getQueryGraph

public CGraph getQueryGraph(java.lang.String idg)
Gets the query graph.

Parameters:
idg - the idg
Returns:
the query graph

getPrototypicGraph

public CGraph getPrototypicGraph(java.lang.String idg)
Gets the prototypic graph.

Parameters:
idg - the idg
Returns:
the prototypic graph

getPatternGraph

public CGraph getPatternGraph(java.lang.String idg)
Gets the pattern graph.

Parameters:
idg - the idg
Returns:
the pattern graph

getIndividualGraph

public CGraph getIndividualGraph(java.lang.String idg)
Gets the individual graph.

Parameters:
idg - the idg
Returns:
the individual graph

getOtherGraph

public CGraph getOtherGraph(java.lang.String idg)
Gets the other graph.

Parameters:
idg - the idg
Returns:
the other graph

getNegativeConstraint

public CGraph getNegativeConstraint(java.lang.String idg)

getPositiveConstraint

public Rule getPositiveConstraint(java.lang.String idg)

getRule

public Rule getRule(java.lang.String idr)
Gets the rule.

Parameters:
idr - the idr
Returns:
the rule

getDefaultRule

public Rule getDefaultRule(java.lang.String idr)

iteratorFacts

public java.util.Iterator<CGraph> iteratorFacts()
Iterator for facts.

Returns:
the iterator< c graph>

iteratorQueries

public java.util.Iterator<CGraph> iteratorQueries()
Iterator for queries.

Returns:
the iterator< c graph>

iteratorPatterns

public java.util.Iterator<CGraph> iteratorPatterns()
Iterator patterns.

Returns:
the iterator< c graph>

IteratorRules

public java.util.Iterator<CGraph> IteratorRules()
Iterator rules.

Returns:
the iterator< c graph>

IteratorDefaultRules

public java.util.Iterator<CGraph> IteratorDefaultRules()

IteratorPConstraints

public java.util.Iterator<CGraph> IteratorPConstraints()

IteratorNConstraints

public java.util.Iterator<CGraph> IteratorNConstraints()

getIndividualGraphSet

public GraphSet getIndividualGraphSet()
Gets the individual graph set.

Returns:
the individual graph set

getFactGraphSet

public GraphSet getFactGraphSet()
Gets the fact graph set.

Returns:
the fact graph set

getQueryGraphSet

public GraphSet getQueryGraphSet()
Gets the query graph set.

Returns:
the query graph set

getPrototypicGraphSet

public GraphSet getPrototypicGraphSet()
Gets the prototypic graph set.

Returns:
the prototypic graph set

getPatternGraphSet

public GraphSet getPatternGraphSet()
Gets the pattern graph set.

Returns:
the pattern graph set

getNConstraintGraphSet

public GraphSet getNConstraintGraphSet()

getPConstraintGraphSet

public RuleSet getPConstraintGraphSet()

getOtherGraphSet

public GraphSet getOtherGraphSet()
Gets the other graph set.

Returns:
the other graph set

getRuleSet

public RuleSet getRuleSet()
Gets the rule set.

Returns:
the rule set

getDefaultRuleSet

public RuleSet getDefaultRuleSet()

delete

public boolean delete(CgObject cog)
Delete.

Parameters:
cog - the cog
Returns:
true, if successful

getPatterns

public java.util.ArrayList<CGraph> getPatterns(java.lang.String type)
Gets the patterns.

Parameters:
type - the type
Returns:
the patterns

iteratorGraphSet

public java.util.Iterator<GraphSet> iteratorGraphSet()

removeUnusedIndividuals

public int removeUnusedIndividuals()

cleanUndefTypes

public void cleanUndefTypes()
resolve undefined types and remove all undefined types that are not used


getScripts

public java.util.Collection<Script> getScripts()
Gets the collection of all scripts.

Returns:
the scripts

getRTScripts

public java.util.Collection<Script> getRTScripts()

getRTScriptMap

public java.util.Map<java.lang.String,Script> getRTScriptMap()

getScript

public Script getScript(java.lang.String id)
Gets the script.

Parameters:
id - the id
Returns:
the script

getRTScript

public Script getRTScript(java.lang.String id)

addScript

public void addScript(Script script)
Adds the script.

Parameters:
script - the script

removeScript

public void removeScript(java.lang.String id)

removeRTScript

public void removeRTScript(java.lang.String id)

addRTScript

public void addRTScript(Script script)