cardialfly / DALNIM

[DEPRECATED] Some source code and scripts for DALNIM
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Create transitivity closure to BPMN child tag relationship #4

Closed cardialfly closed 2 years ago

cardialfly commented 2 years ago

We should have a relationship in TypeDB/TypeQL that represents all descendants of a BPMN/XML tag, so that we can query all BPMN/XML tags associated to a Mission (conceptual model) or BPMN definition.

cardialfly commented 2 years ago

Note: another issue is also dealing with a transitive closure, but with task precedence instead of BPMN parent/child relationship.

See https://github.com/cardialfly/DALNIM/issues/6#issuecomment-1225136302

The above issue/comment is about a transitive closure of precedence of directly-connected chain of gateways (i.e., a gateway connected to another gateway and so on).

cardialfly commented 2 years ago

Defining a new XML tag ancestor-descendant transitive relationship like as follows:

## Transitive parent-child relationship of BPMN/XML tags (useful when deleting everything below BPMN_definitions)
BPMN_hasChildTagTransitive sub relation, relates ancestor, relates descendant;
BPMN_Entity plays BPMN_hasChildTagTransitive:ancestor;
BPMN_Entity plays BPMN_hasChildTagTransitive:descendant;

Also defining 2 rules as follows to force the transitivity of ancestor-descendant:

## Transitive parent-child rule, direct
rule rule_BPMN_hasChildTagTransitive_direct:
when {
 $parent isa BPMN_Entity;
 $child isa BPMN_Entity;
 (parent: $parent, child: $child) isa BPMN_hasChildTag;
} then {
 (ancestor: $parent, descendant: $child) isa BPMN_hasChildTagTransitive;
};

## Transitive parent-child rule, transitive
rule rule_BPMN_hasChildTagTransitive_transitive:
when {
 $grandparent isa BPMN_Entity;
 $parent isa BPMN_Entity;
 $child isa BPMN_Entity;
 (ancestor: $grandparent, descendant: $parent) isa BPMN_hasChildTagTransitive;
 (ancestor: $parent, descendant: $child) isa BPMN_hasChildTagTransitive;
} then {
 (ancestor: $grandparent, descendant: $child) isa BPMN_hasChildTagTransitive;
};

Thus, an example of a query to retrieve this ancestor-descendant relationship would be:

## Query descendants of BPMN definitions tag
match
 $definition isa BPMN_definitions, has attribute $attrib_root;
 $descendant isa BPMN_Entity, has attribute $attrib;
 $rel (ancestor: $definition, descendant: $descendant) isa BPMN_hasChildTagTransitive;
cardialfly commented 2 years ago

Closing this issue as it was addressed and completed with commit https://github.com/cardialfly/DALNIM/commit/d4148bf0369e58b05310d89081c49dde562aff61.