spec: resolves - fill a relation from a register valid on a date - #15
Open
delchev wants to merge 1 commit into
Open
spec: resolves - fill a relation from a register valid on a date#15delchev wants to merge 1 commit into
delchev wants to merge 1 commit into
Conversation
A register says "X applied to Y from A to B" - a vehicle assignment, a price list, a contract in force, an org assignment - and a record carries the match key(s) and a date. Setting the to-one from the row whose period covers that date had no declarative form: dependsOn is an authoring-time copy matched by equality, a decision condition is a single comparison, and a setField step writes a constant, so every application hand-writes the same query-and-classify code. The section specifies the shape and, normatively, the two properties that make it worth having as a construct rather than a query helper: - all three outcomes are distinguished - exactly one covering row fills the relation, while none and more-than-one both leave it unset, and a conforming generator MUST NOT choose between candidate rows; - the attempt is observable - `outcome:` stamps found/notFound/ambiguous into a string field, so the unresolved records form a worklist a person can finish and a decision can branch on. Plus the constraints that keep it unambiguous: the register must carry exactly one to-one to the target, an already-filled relation is skipped, and the write is targeted to the resolved column, the outcome and the status.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The gap
A very common enterprise shape has no declarative form in the format today: resolve a relation by consulting a register with a validity period. The register rows say "X applied to Y from A to B"; an incoming record carries the match key(s) and a date, and a to-one must be set from the row whose period covers that date.
The same pattern under many names:
Nothing reaches it:
dependsOnis an authoring-time copy matched by equality, adecisioncondition is a single comparison, and asetFieldstep writes a constant. Every application hand-writes the same code — query the register, apply the between-dates predicate, classify the result.What this adds
A
resolvessection in the declarative-glue chapter of 1.2:The normative content is deliberately about the two properties that make this a construct rather than a query helper:
outcome:stampsfound/notFound/ambiguousinto a string field, so the unresolved records form a worklist a person can finish and a processdecisioncan branch on the result.Plus the constraints that keep it unambiguous: the register MUST carry exactly one to-one relation to the entity
setpoints at (that relation is the copied value — zero or two is a modelling ambiguity, not something to guess); a record that already carries the relation MUST be skipped, so a manual correction is never overwritten; and the relation, outcome and status MUST be written as one targeted update leaving every other column alone. Period bounds may be open on either side, the end is inclusive, and a date-only bound covers its whole day.Also updates the 1.2 change list, the construct index and the README version row.
Implemented in Eclipse Dirigible (eclipse-dirigible/dirigible#6712, PR eclipse-dirigible/dirigible#6732) — the implementation and this text were written together.