X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fscl%2FGraphPropertyRelation.java;h=a4c1c4b2ace8530a593531a3b094ce6590162cc6;hb=refs%2Fchanges%2F59%2F759%2F1;hp=a6009426f36d7422473128b5be520f90ae7eefbd;hpb=b2c6aed4003ef264fb48eed9ac9f2d0f6c2d5b13;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphPropertyRelation.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphPropertyRelation.java index a6009426f..a4c1c4b2a 100644 --- a/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphPropertyRelation.java +++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/scl/GraphPropertyRelation.java @@ -3,6 +3,7 @@ package org.simantics.modeling.scl; import org.simantics.db.Resource; import org.simantics.scl.compiler.common.names.Name; import org.simantics.scl.compiler.common.names.Names; +import org.simantics.scl.compiler.compilation.CompilationContext; import org.simantics.scl.compiler.elaboration.chr.plan.PlanContext; import org.simantics.scl.compiler.elaboration.expressions.EApply; import org.simantics.scl.compiler.elaboration.expressions.EExternalConstant; @@ -120,22 +121,22 @@ public class GraphPropertyRelation implements SCLRelation { @Override public void generateIterate(PlanContext context, CodeWriter w, long location, int boundMask, Variable[] variables, Expression[] expressions, Expression[] typeConstraintEvidenceParameters) { - Environment env = context.context.environment; + CompilationContext compilationContext = context.context; switch(boundMask) { case BF: context.iterateMaybe(location, w, variables[1], w.apply(location, - env.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType), - typeConstraintEvidenceParameters[0].toVal(env, w), - expressions[0].toVal(env, w), + compilationContext.environment.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType), + typeConstraintEvidenceParameters[0].toVal(compilationContext, w), + expressions[0].toVal(compilationContext, w), w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE))); break; case BB: - context.checkEqualsJust(location, w, expressions[1].toVal(env, w), + context.checkEqualsJust(location, w, expressions[1].toVal(compilationContext, w), w.apply(location, - env.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType), - typeConstraintEvidenceParameters[0].toVal(env, w), - expressions[0].toVal(env, w), + compilationContext.environment.getValue(POSSIBLE_RELATED_VALUE).getValue().createSpecialization(valueType), + typeConstraintEvidenceParameters[0].toVal(compilationContext, w), + expressions[0].toVal(compilationContext, w), w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE))); break; default: throw new IllegalArgumentException(); @@ -144,12 +145,22 @@ public class GraphPropertyRelation implements SCLRelation { @Override public void generateEnforce(PlanContext context, CodeWriter w, long location, Expression[] parameters, Expression[] typeConstraintEvidenceParameters) { - Environment env = context.context.environment; + CompilationContext compilationContext = context.context; w.apply(location, - env.getValue(CLAIM_RELATED_VALUE).getValue().createSpecialization(valueType), - typeConstraintEvidenceParameters[0].toVal(env, w), - parameters[0].toVal(env, w), + compilationContext.environment.getValue(CLAIM_RELATED_VALUE).getValue().createSpecialization(valueType), + typeConstraintEvidenceParameters[0].toVal(compilationContext, w), + parameters[0].toVal(compilationContext, w), w.getModuleWriter().getExternalConstant(propertyRelation, Types.RESOURCE), - parameters[1].toVal(env, w)); + parameters[1].toVal(compilationContext, w)); + } + + @Override + public Type getEnforceEffect() { + return Types.WRITE_GRAPH; + } + + @Override + public Type getQueryEffect() { + return Types.READ_GRAPH; } }