Quick links: Examples - Files.
Classes: Hierarchy - Index - List - Members.
Packages: Index - base - jni.

Public Member Functions | List of all members
cogitant.base.Environment Interface Reference

Environment. More...

+ Inheritance diagram for cogitant.base.Environment:

Public Member Functions

Support support ()
 Support. More...
 
Input/output.
void loadSupport (java.io.InputStream in, IOHandler.Format format) throws ExceptionIO
 Load a support. More...
 
void loadSupport (String f) throws ExceptionIO
 Load a support from a file. More...
 
Collection< EnvironmentObjectloadObjects (java.io.InputStream in, IOHandler.Format format) throws ExceptionIO
 Load graphs/rules/constraints from an input stream. More...
 
Collection< EnvironmentObjectloadObjects (String f) throws ExceptionIO
 Load graphs/rules/constraints from a file. More...
 
String saveSupportString (IOHandler.Format format) throws ExceptionIO
 Save the support into a string. More...
 
String saveObjectsString (Collection< EnvironmentObject > obj, IOHandler.Format format) throws ExceptionIO
 Save objects into a string. More...
 
String saveObjectString (EnvironmentObject obj, IOHandler.Format format) throws ExceptionIO
 Save object into a string. More...
 
void setIOConfig (IOHandler.ConfigPropertyBool prop, boolean val)
 Change I/O configuration. More...
 
Objects.
void deleteObject (EnvironmentObject g) throws cogitant.base.Exception
 Delete an object. More...
 
Collection< EnvironmentObjectobjects ()
 Set of objects (graphs/rules/constraints). More...
 
EnvironmentObject findObject (String name)
 Find an object by its name. More...
 
Graphs.
Graph newGraph ()
 Create a new empty graph. More...
 
Graph newGraph (Graph g)
 Create a new graph as a copy of a graph. More...
 
void deleteGraph (Graph g) throws cogitant.base.Exception
 Delete a graph. More...
 
Collection< Graphgraphs ()
 Set of graphs. More...
 
Graph findGraph (String name)
 Find a graph by its name. More...
 
Graph newGraphSubgraph (Graph g, GraphSubset gs) throws cogitant.base.Exception
 Create a new graph as a subset of a Graph. More...
 
Rules.
void deleteRule (Rule g) throws cogitant.base.Exception
 Delete a rule. More...
 
Collection< Rulerules ()
 Set of rules. More...
 
Rule findRule (String name)
 Find a rule by its name. More...
 
Constraints.
void deleteConstraint (Constraint g) throws cogitant.base.Exception
 Delete a constraint. More...
 
Collection< Constraintconstraints ()
 Set of constraints. More...
 
Constraint findConstraint (String name)
 Find a constraint by its name. More...
 
Projection operations.
ProjectionConfig projectionConfig ()
 Projection config. More...
 
Projection newProjection (Graph g, Graph h) throws cogitant.base.Exception
 Creates a new (empty) projection. More...
 
boolean projectionHas (Graph g, Graph h) throws cogitant.base.Exception
 Projection (existence). More...
 
int projectionNum (Graph g, Graph h) throws cogitant.base.Exception
 Projection (number). More...
 
Collection< ProjectionprojectionFind (Graph g, Graph h) throws cogitant.base.Exception
 Projection (projections). More...
 
void projectionStop ()
 Stop a projection operation. More...
 
java.util.Iterator< ProjectionprojectionIterator (Graph g, Graph h, ProjectionConfig pc) throws cogitant.base.Exception
 Creates a new Iterator<Projection> for the projections from g to h. More...
 
Graph operations.
void graphDisjointSum (Graph g, Graph h) throws cogitant.base.Exception
 Disjoint sum. More...
 
int graphNormalize (Graph g) throws cogitant.base.Exception
 Normalize a graph. More...
 
void graphIrredundant (Graph g) throws cogitant.base.Exception
 Computes the irredundant form of a graph. More...
 
void graphExternalJoin (Graph g1, GraphObject cg1, Graph g2, GraphObject cg2) throws cogitant.base.Exception
 External join. More...
 
void graphExternalJoin (Graph g1, Graph g2, GraphSubset subsetg2, Collection< GraphObject > nodesg1, Collection< GraphObject > nodesg2) throws cogitant.base.Exception
 External joins. More...
 
Graph checkings.
boolean graphVerifyIrredundant (Graph g) throws cogitant.base.Exception
 Irredundant graph. More...
 
boolean graphVerifyEdges (Graph g) throws cogitant.base.Exception
 Well-formed graph. More...
 
void graphEnsureWellFormed (Graph g) throws cogitant.base.Exception
 Verifies if a graph is well-formed. More...
 
Rule operations.
Collection< ProjectionruleApplications (Graph g, Rule r, boolean newkonly) throws cogitant.base.Exception
 Projections from the hypothesis of the rule on the graph. More...
 
boolean ruleApply (Graph g, Rule r, Projection p, boolean newkonly) throws cogitant.base.Exception
 Apply a rule on a graph given a projection of the hypothesis. More...
 
int rulesClosure (Graph g, Collection< Rule > r, int maxapp, int maxpasses) throws cogitant.base.Exception
 Closure of a graph. More...
 
int rulesClosureNormalize (Graph g, Collection< Rule > r, int maxapp, int maxpasses) throws cogitant.base.Exception
 Closure of a graph + Normalize. More...
 
Constraint operations.
boolean constraintSatisfaction (Graph g, Constraint c) throws cogitant.base.Exception
 Satisfaction of a constraint by a graph. More...
 
CoupleOfProjections constraintSatisfactionViolation (Graph g, Constraint c) throws cogitant.base.Exception
 Satisfaction of a constraint by a graph. More...
 
Individual graph operations.
void individualGraphsClosure (Graph g, Collection< Graph > indg) throws cogitant.base.Exception
 Closure of a graph by a set of individual graphs. More...
 

Detailed Description

Environment.

Member Function Documentation

◆ constraints()

Collection<Constraint> cogitant.base.Environment.constraints ( )

Set of constraints.

Implemented in cogitant.jni.Environment.

◆ constraintSatisfaction()

boolean cogitant.base.Environment.constraintSatisfaction ( Graph  g,
Constraint  c 
) throws cogitant.base.Exception

Satisfaction of a constraint by a graph.

Parameters
ga graph of the Environment.
ca constraint of the Environment.
Returns
true iff g satisfies c.

◆ constraintSatisfactionViolation()

CoupleOfProjections cogitant.base.Environment.constraintSatisfactionViolation ( Graph  g,
Constraint  c 
) throws cogitant.base.Exception

Satisfaction of a constraint by a graph.

Parameters
ga graph of the Environment.
ca constraint of the Environment.
Returns
if g satisfies c, returns null. Otherwise:
  • if c is a positive constraint: the first element of the couple of projections contains a projection from the condition of c on g that cannot be extended on a projection of the obligation of c on g.
  • if c is a negative constraint: the first element of the couple of projecitons contains a projection from the condition of c on g such that there exists a projection from the interdiction of c on g. This projection is returned on the second element of the couple.

◆ deleteConstraint()

void cogitant.base.Environment.deleteConstraint ( Constraint  g) throws cogitant.base.Exception

Delete a constraint.

◆ deleteGraph()

void cogitant.base.Environment.deleteGraph ( Graph  g) throws cogitant.base.Exception

Delete a graph.

◆ deleteObject()

void cogitant.base.Environment.deleteObject ( EnvironmentObject  g) throws cogitant.base.Exception

Delete an object.

◆ deleteRule()

void cogitant.base.Environment.deleteRule ( Rule  g) throws cogitant.base.Exception

Delete a rule.

◆ findConstraint()

Constraint cogitant.base.Environment.findConstraint ( String  name)

Find a constraint by its name.

Parameters
namesearched name.
Returns
constraint having this name or null.
See also
findObject().

Implemented in cogitant.jni.Environment.

◆ findGraph()

Graph cogitant.base.Environment.findGraph ( String  name)

Find a graph by its name.

Parameters
namesearched name.
Returns
graph having this name or null.
See also
findObject().

Implemented in cogitant.jni.Environment.

◆ findObject()

EnvironmentObject cogitant.base.Environment.findObject ( String  name)

Find an object by its name.

Parameters
namesearched name.
Returns
object having this name or null.
See also
EnvironmentObject.name().

Implemented in cogitant.jni.Environment.

◆ findRule()

Rule cogitant.base.Environment.findRule ( String  name)

Find a rule by its name.

Parameters
namesearched name.
Returns
rule having this name or null.
See also
findObject().

Implemented in cogitant.jni.Environment.

◆ graphDisjointSum()

void cogitant.base.Environment.graphDisjointSum ( Graph  g,
Graph  h 
) throws cogitant.base.Exception

Disjoint sum.

Parameters
ga graph of the Environment. This graph is modified and contains the disjoint sum g + h when this method finishes.
ha graph of the Environment.

◆ graphEnsureWellFormed()

void cogitant.base.Environment.graphEnsureWellFormed ( Graph  g) throws cogitant.base.Exception

Verifies if a graph is well-formed.

Throws an if the graph is not well-formed.

Parameters
ga graph of the Environment.

◆ graphExternalJoin() [1/2]

void cogitant.base.Environment.graphExternalJoin ( Graph  g1,
GraphObject  cg1,
Graph  g2,
GraphObject  cg2 
) throws cogitant.base.Exception

External join.

Parameters
g1graph of the Environment. This graph is modified.
cg1concept node of g1.
g2graph of the Environment.
cg2concept node of g2.

◆ graphExternalJoin() [2/2]

void cogitant.base.Environment.graphExternalJoin ( Graph  g1,
Graph  g2,
GraphSubset  subsetg2,
Collection< GraphObject nodesg1,
Collection< GraphObject nodesg2 
) throws cogitant.base.Exception

External joins.

Parameters
g1graph of the Environment. This graph is modified.
g2graph of the Environment.
subsetg2subset of g2 that contains nodes of g2 to copy into g1.
nodesg1concept nodes of g1.
nodesg2concept nodes of g2 that are joined with nodes of g1. The i-th node of nodesg2 is joind with the i-th node of nodesg1.

◆ graphIrredundant()

void cogitant.base.Environment.graphIrredundant ( Graph  g) throws cogitant.base.Exception

Computes the irredundant form of a graph.

Parameters
ggraph of the Environment. This graph is modified.

◆ graphNormalize()

int cogitant.base.Environment.graphNormalize ( Graph  g) throws cogitant.base.Exception

Normalize a graph.

Parameters
ga graph of the Environment. This graph is modified.
Returns
number of merges.

◆ graphs()

Collection<Graph> cogitant.base.Environment.graphs ( )

Set of graphs.

Implemented in cogitant.jni.Environment.

◆ graphVerifyEdges()

boolean cogitant.base.Environment.graphVerifyEdges ( Graph  g) throws cogitant.base.Exception

Well-formed graph.

Parameters
ga graph of the Environment.
Returns
true iff a does not contain pending edges.

◆ graphVerifyIrredundant()

boolean cogitant.base.Environment.graphVerifyIrredundant ( Graph  g) throws cogitant.base.Exception

Irredundant graph.

Parameters
ga graph of the Environment.
Returns
true iff a is irredundant.

◆ individualGraphsClosure()

void cogitant.base.Environment.individualGraphsClosure ( Graph  g,
Collection< Graph indg 
) throws cogitant.base.Exception

Closure of a graph by a set of individual graphs.

Note that individual graphs are used to expand concept nodes of the initial graph only. Added nodes are not expanded.

Parameters
ga graph of the Environment. This graph is modified by the method and contains the closure of the initial graph with th set of individual graphs.
indgset of individual graphs.

◆ loadObjects() [1/2]

Collection<EnvironmentObject> cogitant.base.Environment.loadObjects ( java.io.InputStream  in,
IOHandler.Format  format 
) throws ExceptionIO

Load graphs/rules/constraints from an input stream.

Parameters
ininput stream.
formatinput format.
Returns
collection of loaded objects.

◆ loadObjects() [2/2]

Collection<EnvironmentObject> cogitant.base.Environment.loadObjects ( String  f) throws ExceptionIO

Load graphs/rules/constraints from a file.

Parameters
ffilename.

Implemented in cogitant.jni.Environment.

◆ loadSupport() [1/2]

void cogitant.base.Environment.loadSupport ( java.io.InputStream  in,
IOHandler.Format  format 
) throws ExceptionIO

Load a support.

This method replaces the current support.

Parameters
ininput stream.
formatinput format.

◆ loadSupport() [2/2]

void cogitant.base.Environment.loadSupport ( String  f) throws ExceptionIO

Load a support from a file.

This method replaces the current support.

Parameters
ffilename.

Implemented in cogitant.jni.Environment.

◆ newGraph() [1/2]

Graph cogitant.base.Environment.newGraph ( )

Create a new empty graph.

Implemented in cogitant.jni.Environment.

◆ newGraph() [2/2]

Graph cogitant.base.Environment.newGraph ( Graph  g)

Create a new graph as a copy of a graph.

◆ newGraphSubgraph()

Graph cogitant.base.Environment.newGraphSubgraph ( Graph  g,
GraphSubset  gs 
) throws cogitant.base.Exception

Create a new graph as a subset of a Graph.

◆ newProjection()

Projection cogitant.base.Environment.newProjection ( Graph  g,
Graph  h 
) throws cogitant.base.Exception

Creates a new (empty) projection.

◆ objects()

Collection<EnvironmentObject> cogitant.base.Environment.objects ( )

Set of objects (graphs/rules/constraints).

Implemented in cogitant.jni.Environment.

◆ projectionConfig()

ProjectionConfig cogitant.base.Environment.projectionConfig ( )

Projection config.

Implemented in cogitant.jni.Environment.

◆ projectionFind()

Collection<Projection> cogitant.base.Environment.projectionFind ( Graph  g,
Graph  h 
) throws cogitant.base.Exception

Projection (projections).

Parameters
ga graph of the Environment.
ha normal graph of the Environment.
Returns
projections from g into h.

◆ projectionHas()

boolean cogitant.base.Environment.projectionHas ( Graph  g,
Graph  h 
) throws cogitant.base.Exception

Projection (existence).

Parameters
ga graph of the Environment.
ha normal graph of the Environment.
Returns
true if there is a projection from g into h, otherwise 0.

◆ projectionIterator()

java.util.Iterator<Projection> cogitant.base.Environment.projectionIterator ( Graph  g,
Graph  h,
ProjectionConfig  pc 
) throws cogitant.base.Exception

Creates a new Iterator<Projection> for the projections from g to h.

Parameters
ga graph of the Environment.
ha norma graph of the Environment.
pcprojection config. If null, uses the default ProjectionConfig from the Environment.
Returns
projections form g to h.
Warning
Once this method has been called, modifying g or h is strictly forbidden.

◆ projectionNum()

int cogitant.base.Environment.projectionNum ( Graph  g,
Graph  h 
) throws cogitant.base.Exception

Projection (number).

Parameters
ga graph of the Environment.
ha normal graph of the Environment.
Returns
number of projections from g into h.

◆ projectionStop()

void cogitant.base.Environment.projectionStop ( )

Stop a projection operation.

When called from another thread, this method ask the projection operation (called by projectionHas(), projectionNum() or projectionFind()) to stop as soon as possible.

Implemented in cogitant.jni.Environment.

◆ ruleApplications()

Collection<Projection> cogitant.base.Environment.ruleApplications ( Graph  g,
Rule  r,
boolean  newkonly 
) throws cogitant.base.Exception

Projections from the hypothesis of the rule on the graph.

Parameters
ga graph of the Environment.
ra rule of the Environement.
newkonlyif true returns only projections that may produce new knowledge, if false returns each projection from thy hypothesis of r to g.
Returns
projections from the hypothesis of r to g.

◆ ruleApply()

boolean cogitant.base.Environment.ruleApply ( Graph  g,
Rule  r,
Projection  p,
boolean  newkonly 
) throws cogitant.base.Exception

Apply a rule on a graph given a projection of the hypothesis.

Parameters
ga graph of the Environment. This graph is modified by the method.
ra rule of the Environement.
pa projection of the hypothesis of r on g.
newkonlyif true apply r only if this application adds new knowledge to g. If false, always apply the rule.
Returns
true iff the rule has been applied.

◆ rules()

Collection<Rule> cogitant.base.Environment.rules ( )

Set of rules.

Implemented in cogitant.jni.Environment.

◆ rulesClosure()

int cogitant.base.Environment.rulesClosure ( Graph  g,
Collection< Rule r,
int  maxapp,
int  maxpasses 
) throws cogitant.base.Exception

Closure of a graph.

Parameters
ga graph of the Environment. This graph is modified and contains the closure of the initial graph with the set of rules.
ra set of rules. If null every rule of the Environment is taken into account.
maxappmaximal number of rule applications (0: unlimited).
maxpassesmaximal number of passes. (0: unlimited).
Returns
number of rule applications.

◆ rulesClosureNormalize()

int cogitant.base.Environment.rulesClosureNormalize ( Graph  g,
Collection< Rule r,
int  maxapp,
int  maxpasses 
) throws cogitant.base.Exception

Closure of a graph + Normalize.

Normalizes g after each application of a rule.

Parameters
ga graph of the Environment. This graph is modified and contains the closure of the initial graph with the set of rules.
ra set of rules. If null every rule of the Environment is taken into account.
maxappmaximal number of rule applications (0: unlimited).
maxpassesmaximal number of passes. (0: unlimited).
Returns
number of rule applications.

◆ saveObjectsString()

String cogitant.base.Environment.saveObjectsString ( Collection< EnvironmentObject obj,
IOHandler.Format  format 
) throws ExceptionIO

Save objects into a string.

Parameters
objobjects.
formatoutput format.
Returns
a string containing a serialization of the objects in the given format.

◆ saveObjectString()

String cogitant.base.Environment.saveObjectString ( EnvironmentObject  obj,
IOHandler.Format  format 
) throws ExceptionIO

Save object into a string.

Parameters
objobject.
formatoutput format.
Returns
a string containing a serialization of the object in the given format.

◆ saveSupportString()

String cogitant.base.Environment.saveSupportString ( IOHandler.Format  format) throws ExceptionIO

Save the support into a string.

Parameters
formatoutput format.
Returns
a string containing a serialization of the support in the given format.

◆ setIOConfig()

void cogitant.base.Environment.setIOConfig ( IOHandler.ConfigPropertyBool  prop,
boolean  val 
)

Change I/O configuration.

Parameters
propproperty.
valvalue.

Implemented in cogitant.jni.Environment.

◆ support()

Support cogitant.base.Environment.support ( )