4.1.12.2. rule/CompositionMatch¶
- class mod.RCMatch¶
A class for interactively constructing match between two rules used for composition. That is, for two rules \(p_1 = (L_1 \leftarrow K_1 \rightarrow R_1)\) and \(p_2 = (L_2 \leftarrow K_2 \rightarrow R_2)\), an object represents match between \(R_1\) and \(L_2\) which indicates a common subgraph \(R_1 \leftarrow M \rightarrow L_2\).
See also [AFMS-RC] for details of how composition of rules can be computed.
- __init__(rFirst, rSecond, labelSettings=LabelSettings(LabelType.String, LabelRelation.Specialisation))¶
Construct an empty overlap.
- Parameters:
rFirst (Rule) – the first rule \(p_1\).
rSecond (Rule) – the second rule \(p_2\).
labelSettings (LabelSettings) – the settings to use for the morphisms \(R_1 \leftarrow M \rightarrow L_2\).
- Raises:
LogicError – if either rule is
None
.
- labelSettings¶
(Read-only) The settings for the morphisms in the match.
- Type:
- __getitem__(vFirst)¶
- __getitem__(vSecond)
- Parameters:
vFirst (Rule.RightGraph.Vertex) – a vertex of \(R_1\) to return the mapped vertex for.
vSecond (Rule.LeftGraph.Vertex) – a vertex of \(L_2\) to return the mapped vertex for.
- Returns:
the vertex the given vertex is mapped to, or a null vertex if it is not mapped.
- Raises:
LogicError – if either vertex is a null vertex.
LogicError – if either vertex does not belong to their respective rules.
- push(vFirst, vSecond)¶
Extend the common subgraph (match) of \(R_1\) and \(L_2\) by identifying the given vertices from each of the graphs.
- Raises:
LogicError – if either vertex is a null vertex.
LogicError – if either vertex does not belong to their respective rules.
LogicError – if either vertex is already mapped.
LogicError – if the extension of the match is infeasible.
- pop()¶
Pop the latest pushed vertex pair.
- Raises:
LogicError – if
self.size == 0
.
- compose(*, verbose=False)¶
- composeWithMaps(*, verbose=False)¶
- Parameters:
verbose (bool) – whether to output debug messages from the composition algorithm.
- Returns:
the composition of the two rules along the match, either just the composed rule or the composed rule with maps relating its vertices and the vertices in the input. If the composition is not defined,
None
is returned.- Return type:
- composeAll(*, maximum=False, verbose=False)¶
- composeAllWithMaps(*, maximum=False, verbose=False)¶
- Parameters:
- Returns:
the composition of the two rules along enumerated matches, either just the composed rules or each of the composed rules with maps relating their vertices and the vertices in the input, including the full match used for each particular composition. The enumerated matches are all those that are extensions of the current match, and the match itself.
- Return type:
- class RCMatch.Result¶
Representation of the full result of a composition.
- mFirstToSecond¶
A map of vertices in \(p_1\) to the vertices of \(p_2\), i.e., the match used for composition.
- Type:
- mFirstToRes¶
A map of vertices in \(p_1\) to the vertices of the composed rule.
- Type:
- mSecondToRes¶
A map of vertices in \(p_2\) to the vertices of the composed rule.
- Type: