3.2.13.2. rule/CompositionExpr.hpp

In the rule::RCExp namespace the data structures and operators for representing rule composition expressions are defined. An expression can be evaluated through the method rule::Composer::eval(). The result of an expression is a list of rules.

See also [AFMS-RC], [AFMS-RC-AtomMap], and [AFMS-RC-Matrix] for details on how these expressions are computed internally, and further examples of how they can be used to solve particular problems.

class rule::RCExp::Union

When evaluated, the subexpressions are evaluated and the results are combined. The combination is either simple concatenation of lists, or taking the union of the subresults.

Union(std::vector<Expression> exps)
Throws:

LogicError if exps.empty().

friend std::ostream &operator<<(std::ostream &s, const Union &par)
const std::vector<Expression> &getExpressions() const
class rule::RCExp::Bind

When evaluated, returns a list with a single rule, \(\emptyset \leftarrow \emptyset \rightarrow G\), for the given graph \(G\).

Bind(std::shared_ptr<graph::Graph> g)
Throws:

LogicError if !g.

friend std::ostream &operator<<(std::ostream &s, const Bind &b)
std::shared_ptr<graph::Graph> getGraph() const
class rule::RCExp::Id

When evaluated, returns a list with a single rule, \(G \leftarrow G \rightarrow G\), for the given graph \(G\).

Id(std::shared_ptr<graph::Graph> g)
Throws:

LogicError if !g.

friend std::ostream &operator<<(std::ostream &s, const Id &i)
std::shared_ptr<graph::Graph> getGraph() const
class rule::RCExp::Unbind

When evaluated, returns a list with a single rule, \(G \leftarrow \emptyset \rightarrow \emptyset\), for the given graph \(G\).

Unbind(std::shared_ptr<graph::Graph> g)
Throws:

LogicError if !g.

friend std::ostream &operator<<(std::ostream &s, const Unbind &u)
std::shared_ptr<graph::Graph> getGraph() const
class rule::RCExp::Expression

A class containing any type of the rule composition expression. That is, it acts as a variant.

Expression(std::shared_ptr<Rule> r)
Expression(Union u)
Expression(Bind bind)
Expression(Id id)
Expression(Unbind unbind)
Expression(ComposeCommon compose)
Expression(ComposeParallel compose)
Expression(ComposeSub compose)
Expression(ComposeSuper compose)
Throws:

LogicError if !r.

friend std::ostream &operator<<(std::ostream &s, const Expression &exp)
class rule::RCExp::ComposeCommon

When evaluated, evaluate the first and second expressions to obtain list of rules \(P_1\) and \(P_2\). For each pair of rules \(p_1 = (L_1\leftarrow K_1\rightarrow R_1) \in P_1\) and \(p_2 = (L_2\leftarrow K_2\rightarrow R_2) \in P_2\), compose them by common subgraphs of \(R_1\) and \(L_2\), possibly limited to connected subgraphs or to the subgraphs of maximum size. By default the empty subgraph is not considered, but can be enabled to be.

ComposeCommon(Expression first, Expression second, bool maximum, bool connected, bool includeEmpty)
friend std::ostream &operator<<(std::ostream &s, const ComposeCommon &c)
Expression first
Expression second
bool maximum
bool connected
bool includeEmpty
class rule::RCExp::ComposeParallel

When evaluated, evaluate the first and second expressions to obtain list of rules \(P_1\) and \(P_2\). For each pair of rules \(p_1 = (L_1\leftarrow K_1\rightarrow R_1) \in P_1\) and \(p_2 = (L_2\leftarrow K_2\rightarrow R_2) \in P_2\), compose them by the empty overlap of \(R_1\) and \(L_2\).

ComposeParallel(Expression first, Expression second)
friend std::ostream &operator<<(std::ostream &s, const ComposeParallel &c)
Expression first
Expression second
class rule::RCExp::ComposeSub

When evaluated, evaluate the first and second expressions to obtain list of rules \(P_1\) and \(P_2\). For each pair of rules \(p_1 = (L_1\leftarrow K_1\rightarrow R_1) \in P_1\) and \(p_2 = (L_2\leftarrow K_2\rightarrow R_2) \in P_2\), compose them by common subgraphs of \(R_1\) and \(L_2\) such that \(R_1\) is the common subgraph, i.e., that \(R_1\) is matched as a subgraph of \(L_2\).

If allowPartial is set true, then each non-empty subset of connected components of \(R_1\) are matched as a subgraph of \(L_2\).

ComposeSub(Expression first, Expression second, bool allowPartial)
friend std::ostream &operator<<(std::ostream &s, const ComposeSub &c)
Expression first
Expression second
bool allowPartial
class rule::RCExp::ComposeSuper

When evaluated, evaluate the first and second expressions to obtain list of rules \(P_1\) and \(P_2\). For each pair of rules \(p_1 = (L_1\leftarrow K_1\rightarrow R_1) \in P_1\) and \(p_2 = (L_2\leftarrow K_2\rightarrow R_2) \in P_2\), compose them by common subgraphs of \(R_1\) and \(L_2\) such that \(L_2\) is the common subgraph, i.e., that \(L_2\) is matched as a subgraph of \(R_1\).

If allowPartial is set true, then each non-empty subset of connected components of \(L_2\) are matched as a subgraph of \(R_1\).

ComposeSuper(Expression first, Expression second, bool allowPartial, bool enforceConstraints)
friend std::ostream &operator<<(std::ostream &s, const ComposeSuper &c)
Expression first
Expression second
bool allowPartial
bool enforceConstraints