I’m trying to describe a union
on a reference set
in a collection
with an acyclic graph
constraint. This is what I have:
'Partijen': collection ['Partij'] = ^ ^ .'Partijen'* .'Soort partij'?'Deelpartij'.'Bewerkingen'.'Etiketteren'?'Ja'.'Ingepland'?'Ja'.'Uitgevoerd'?'Nee' {
'Partij': text -> ^ ^ ^ .'Partijen'[] .'Soort partij'?'Deelpartij'.'Bewerkingen'.'Etiketteren'?'Ja'.'Ingepland'?'Ja'.'Uitgevoerd'?'Nee'
= key
'Deelpartijen': collection ['Partij'] = union (
'In partij' = >'Partij' ^ ^ ^ ^ ^ <'Deelpartijen'[ ^ ^ ^ .'Partijen' sibling * ] // <-- errors here!
) {
'Partij': text -> ^ ^ ^ ^ .'Partijen'[] = key
}
...
}
But this results in 2 errors I don’t understand and can’t resolve:
equality constraint violation for ‘dependency of reference set’:
- expected: ‘dependency’ of type ‘step’
defined by .‘Productie’.‘Etiketteren’.‘Partijen’.‘Partij’ of type ‘erface_notification/schema.alan.json’!‘node’.‘attributes’.‘type’?‘property’.‘type’?‘text’.‘has reference’?‘yes’
- but found: ‘dependency’ of type ‘self’
defined by .<root> of type ‘erface_notification/schema.alan.json’
no valid ‘head node type’ found for ‘type’ option ‘sibling’. Unexpected ‘value object’:
- expected: ‘node’
- but found: ‘collection’
defined by .‘Partijen’ of type ‘erface_notification/schema.alan.json’!‘node’.‘attributes’.‘type’?‘property’
I tried several combinations of node path, sibling
and *
without success.
When making a union based on a reference-set, the key of the derived collection needs to be the identical path as the path between [ ].
So in your example:
'Partij': text -> ^ ^ ^ .'Partijen' sibling = key
or alternatively:
<'Deelpartijen' [ ^ ^ ^ ^ .'Partijen' * ]
Unfortunately this solutions results in an error as well:
'Partijen': collection ['Partij'] = ^ ^ .'Partijen'* .'Soort partij'?'Deelpartij'.'Bewerkingen'.'Etiketteren'?'Ja'.'Ingepland'?'Ja'.'Uitgevoerd'?'Nee' {
'Partij': text -> ^ ^ ^ .'Partijen'[] .'Soort partij'?'Deelpartij'.'Bewerkingen'.'Etiketteren'?'Ja'.'Ingepland'?'Ja'.'Uitgevoerd'?'Nee'
= key
'Deelpartijen': collection ['Partij'] = union (
'In partij' = >'Partij' ^ ^ ^ ^ ^ <'Deelpartijen'[ ^ ^ ^ .'Partijen'* ] // <-- error between [ ] !
) {
'Partij': text -> ^ ^ ^ ^ .'Partijen'[] = key
}
...
}
With error message:
equality constraint violation for ‘dependency of reference set’:
- expected: ‘relative object location’ of type ‘sibling entity’
defined by .‘Partijen’.‘Bron’ of type ‘erface_notification/schema.alan.json’!‘graph constraints definition’.‘graphs’
- but found: ‘relative object location’ of type ‘context entity’
defined by .‘Partijen’ of type ‘erface_notification/schema.alan.json’!‘node’.‘attributes’.‘type’?‘property’
Which to me indicates I need to use sibling
somehow.
According to the grammar this should be possible, but I can’t seem to figure out how:
'reference set subset step' {
'subset': stategroup (
'no' { [ * ] }
'yes' { [ [, ] ]
'head': component 'variablized object path'
'type': [, * ] stategroup (
'simple' { }
'sibling' { [ sibling ] } // <-- !!
)
}
)
}
Try
[ >'Partij' ^ ^ ^ ^ ^ sibling ]
And define the key accordingly.
Thanks! That did it. Only needed an asterisk (*) at the end:
'Deelpartijen': collection ['Partij'] = union (
'In partij' = >'Partij' ^ ^ ^ ^ ^ <'Deelpartijen'[ >'Partij' ^ ^ ^ ^ ^ sibling * ]
) { ... }