Class PathAnalysis
java.lang.Object
org.ehrbase.openehr.aqlengine.pathanalysis.PathAnalysis
AQL paths occur in select expressions, where conditions, but also within the predicates of AQL paths.
Paths originate from structure RM types from the FROM clause, or from a path node featuring a predicate. FROM roots can be constrained via predicates and additional CONTAINS clauses.
select o[openEHR-EHR-OBSERVATION.blood_pressure.v2]/data[archetype_node_id="at0001" and name/value="History"]/events FROM ENTRY o;A path originates from a structure RM type from the FROM clause, which is constrained via predicates and additional CONTAINS clauses. or from the node featuring a predicate. It consists of a list of attributes, which can be constrained by additional predicates. The RM model specifies the RM types with their attributes and data types of those attributes.
This information can be used to infer
- if a path is valid
- if a path, or a node, is single-valued
- the possible data types of a path
Since many WhereConditions only operate on certain data types, these can also constrain the paths.
Note that these constraints may, however, not inherently apply to the path if the constraint is part of a OR or NOT condition.
The information can be used to determine how the field needs to be accessed in the database structure, e.g.
- What structure nodes need to be joined
- If joins can/must be shared between different paths (For performance reasons, but also in order to prevent cartesian products due to multiple-valued paths sharing common base objects)
- If an RM object needs to be reconstructed
Rules that constrain the base type of a node
- The candidate base types do not contain abstract classes ( derived classes, instead)
- The candidate base types only contain classes that feature the given attribute
- The candidate base types only contain classes where the attribute types match
- If a base type does not possess the TODO
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic class -
Method Summary
Modifier and TypeMethodDescriptionstatic ANodeanalyzeAqlPathTypes(String rootType, List<org.ehrbase.openehr.sdk.aql.dto.path.AndOperatorPredicate> variablePredicates, List<org.ehrbase.openehr.sdk.aql.dto.path.AndOperatorPredicate> rootPredicates, org.ehrbase.openehr.sdk.aql.dto.path.AqlObjectPath path, Set<String> candidateTypes) Determines for each node of the path (resulting from the path hierarchy directly, or from predicates) a set of possible RM or Foundational typesstatic Map<ANode, Map<String, PathAnalysis.AttInfo>> createAttributeInfos(ANode rootNode)
-
Method Details
-
createAttributeInfos
-
analyzeAqlPathTypes
public static ANode analyzeAqlPathTypes(String rootType, List<org.ehrbase.openehr.sdk.aql.dto.path.AndOperatorPredicate> variablePredicates, List<org.ehrbase.openehr.sdk.aql.dto.path.AndOperatorPredicate> rootPredicates, org.ehrbase.openehr.sdk.aql.dto.path.AqlObjectPath path, Set<String> candidateTypes) Determines for each node of the path (resulting from the path hierarchy directly, or from predicates) a set of possible RM or Foundational types- Parameters:
rootType-variablePredicates-rootPredicates-path-candidateTypes-- Returns:
-