]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.structural2/src/org/simantics/structural2/variables/StandardProceduralChildVariable.java
Non-constant external value configuration via procedural UCs.
[simantics/platform.git] / bundles / org.simantics.structural2 / src / org / simantics / structural2 / variables / StandardProceduralChildVariable.java
index e96fd050a021ee1c9451efe19c1ee88d112d5855..e7ba5ab7879c8749ffc527597e47c205629539f6 100644 (file)
@@ -7,6 +7,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
 
 import org.simantics.databoard.Bindings;
@@ -115,6 +116,14 @@ public class StandardProceduralChildVariable extends AbstractChildVariable {
                    } else if (p.value instanceof Expression) {
                        Expression expression = (Expression)p.value;
                            this.properties.put(pn, new StructuralProceduralExpressionPropertyVariable(graph, this, p.relation, expression.text) );
+                   } else if (this.properties.containsKey(pn)) {
+                       // The property overrides the value of an asserted property variable
+                       StandardAssertedGraphPropertyVariable assertedValue = (StandardAssertedGraphPropertyVariable) this.properties.get(pn);
+                       if (Objects.equals(assertedValue.property.predicate, p.relation)) {
+                               this.properties.put(pn, new StandardProdeduralPropertyVariable(graph, this, assertedValue, p.value));
+                       } else {
+                               LOGGER.warn("Ignored attempt to override asserted property {}/{}#{} with a different relation", parent.getURI(graph), name, pn);
+                       }
                    } else {
                            this.properties.put(pn, new StandardConstantGraphPropertyVariable(graph, this, p.relation, p.value) );
                    }