Class CollapseSiblingPatterns
java.lang.Object
com.northconcepts.datapipeline.foundations.pipeline.tree.detect.TreeTransformer
com.northconcepts.datapipeline.foundations.pipeline.tree.detect.CollapseSiblingPatterns
Collapses down (merges) sibling tree-node-paths whose names share a derivable naming/wildcard
pattern (see
SiblingSetRule) into a single wildcard node, mirroring what the build-time
NodeNameRules produce for individually dynamic names: the collapsed node is named
*, its XPath expression ends in node(), member names become its values,
and descendant XPaths collapse the merged segment to *.
Opt-in — insert it before the detection passes with
TreeDetectionStrategy.enableSiblingPatternCollapse(), ideally together with
standard(true) so wildcard post-processing
(leftover-sibling merging and synthetic value fields for childless nodes) applies to the
collapsed node too. One pattern is collapsed per parent: rules are consulted in order and the
first rule to derive a pattern wins, so rule order sets precedence (within
AffixSiblingSetRule, competing name buckets are tried largest first).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRule(SiblingSetRule rule) Adds a rule, consulted after the existing ones.Removes all rules, including the defaultAffixSiblingSetRule.protected voidcollapseChildren(TreeNode parent) Merges the parent's children that match the first pattern a rule derives into one wildcard node; called for every node, children before parents.getCandidateSiblings(TreeNode parent) Returns the children eligible for pattern derivation: named element/field nodes, excluding attributes, existing wildcards, JSON container nodes, and nodes without an XPath expression.getRules()Returns the editable list of rules, consulted in order; the first one to derive a pattern wins.voidRuns this pass over the loaded tree, updating its nodes in place.Methods inherited from class com.northconcepts.datapipeline.foundations.pipeline.tree.detect.TreeTransformer
merge, mergeChildren
-
Constructor Details
-
CollapseSiblingPatterns
public CollapseSiblingPatterns()Creates a pass with a singleAffixSiblingSetRule.
-
-
Method Details
-
getRules
Returns the editable list of rules, consulted in order; the first one to derive a pattern wins. -
addRule
Adds a rule, consulted after the existing ones. -
clearRules
Removes all rules, including the defaultAffixSiblingSetRule. -
transform
Description copied from class:TreeTransformerRuns this pass over the loaded tree, updating its nodes in place.- Specified by:
transformin classTreeTransformer
-
collapseChildren
Merges the parent's children that match the first pattern a rule derives into one wildcard node; called for every node, children before parents. -
getCandidateSiblings
Returns the children eligible for pattern derivation: named element/field nodes, excluding attributes, existing wildcards, JSON container nodes, and nodes without an XPath expression.
-