Equality constraint violation for 'dependency'

'SPC' = <'Sales Purchase Lines'* >'Sales Colli Type' in the following code returns the following error. I understand there is something incorrect regarding the path, but I cannot figure out what the solution should be. Can somebody please help me with a solution?

'Orders': collection ['Sales Nr.'] {
  'Sales Nr.': text
  'Order Lines': collection ['Line nr.'] {
    'Line nr.': text
    'Kind of Produce': text -> ^ ^ .'Kinds of Produce'[]
    'Colli Type': text -> >'Kind of Produce'.'Colli Types'[] as $
    	where 'Same' ~> >'Customer Item'>'Net Weight Primary' is ( $ >'Colli Type'>'Primary Container Weight' )
		@default: >'Customer Item'.'Colli Type specified'?'Yes'.'Colli Type'
    'Purchases': collection ['Purchase'] {
    	'Purchase Order': text -> ^ ^ ^ .'Purchase Orders'[]
		'Kind of Produce': text ~> ^ ^ ^ .'Kinds of Produce'[] = ^ .'Kind of Produce'
		'Sales Colli Type': text ~> >'Kind of Produce'.'Colli Types'[] = ^ .'Colli Type'
    }
  }
}

'Planning': collection ['Kind'] = union (
	'S' = .'Orders'* .'Show in planning'?'Yes' ^ .'Order Lines'* >'Kind of Produce'
	'SP' = .'Orders'* .'Show in planning'?'Yes' ^ .'Order Lines'* .'Purchases'* .'Repurposing Colli Type'?'Yes' ^ .'Order Line'&'Kind of Produce'
) {
	'Kind': text -> ^ .'Kinds of Produce'[] = key
    'Sales Lines': reference-set -> ^ .'Orders'* .'Order Lines'* = branch 'S'
	'Sales Purchase Lines': reference-set -> ^ .'Orders'* .'Order Lines'* .'Purchases'* = branch 'SP'

    'Colli': collection ['Colli Type'] = union (
      'S' = <'Sales Lines'* >'Colli Type'
      'SPC' = <'Sales Purchase Lines'* >'Sales Colli Type'
      'SPP' = <'Sales Purchase Lines'* .'Order Line'&'Colli Type'
    ){
      'Colli Type': text -> ^ >'Kind'.'Colli Types'[] = key
    }
}

equality constraint violation for 'dependency':
	- expected:  .'Planning'.'Kind' of type 'application'!'node'.'attributes'.'type'?'property'.'type'?'text'.'has reference'?'yes' at /home/coder/project/models/model/application.alan:16159:19 to 16159:42
	- but found: .'Orders'.'Order Lines'.'Purchases'.'Kind of Produce' of type 'application'!'node'.'attributes'.'type'?'property'.'type'?'text'.'has reference'?'yes' at /home/coder/project/models/model/application.alan:13396:32 to 13396:59
equality constraint violation for 'dependency':
application.alan(16159, 19): - expected: .'Planning'.'Kind' of type 'application'!'node'.'attributes'.'type'?'property'.'type'?'text'.'has reference'?'yes'
application.alan(13396, 32): - but found: .'Orders'.'Order Lines'.'Purchases'.'Kind of Produce' of type 'application'!'node'.'attributes'.'type'?'property'.'type'?'text'.'has reference'?'yes'

Figured it out. The problem is situated in the definition of SP branch in de Planning union. I had to distinguish between two different paths that lead to ‘Kind of Produce’.‘Colli Types’ [.]

		'SPC' = .'Orders'* .'Show in planning'?'Yes' ^ .'Order Lines'* .'Purchases'* .'Repurposing Colli Type'?'Yes' ^ .'Order Line'&'Kind of Produce'
		'SPP' = .'Orders'* .'Show in planning'?'Yes' ^ .'Order Lines'* .'Purchases'* .'Repurposing Colli Type'?'Yes' ^ >'Kind of Produce'
1 Like