include "Simantics/DB" include "Simantics/Variables" include "Simantics/Ontologies" include "http://www.simantics.org/Modeling-1.2/SCLQuery" as SCLQuery importJava "org.simantics.scl.compiler.errors.CompilationError" where data CompilationError importJava "org.simantics.scl.ui.editor.TextAndErrors" where data TextAndErrors createTextAndErrors :: String -> [CompilationError] -> TextAndErrors createSCLModuleAction :: Resource -> () createSCLModuleAction res = ignore $ syncWrite (\() -> createSCLModuleDefault res) createSCLScriptAction :: Resource -> () createSCLScriptAction res = ignore $ syncWrite (\() -> createSCLScriptDefault res) createPGraphAction :: Resource -> () createPGraphAction res = ignore $ syncWrite (\() -> createPGraphDefault res) createSCLValueIndependent :: Resource -> String -> Resource createSCLValueIndependent valueType expression = do value = newResource () claim value L0.InstanceOf valueType claimRelatedValue value L0.SCLValue.expression expression value createSCLValue :: Resource -> Resource -> Resource -> String -> Resource createSCLValue container predicate valueType expression = do value = createSCLValueIndependent valueType expression claim container predicate value value setExpression :: Variable -> String -> () setExpression self expression = do res = represents self claimRelatedValue res L0.SCLValue.expression expression importJava "org.simantics.modeling.ModelingUtils" where createSCLModuleDefault :: Resource -> () createSCLScriptDefault :: Resource -> () createPGraphDefault :: Resource -> () "Use [createSCLModuleR](#createSCLModuleR) instead." @deprecated createSCLModule :: Resource -> String -> () "Use [createSCLScriptR](#createSCLScriptR) instead." @deprecated createSCLScript :: Resource -> String -> () "Use [createPGraphR](#createPGraphR) instead." @deprecated createPGraph :: Resource -> String -> () """ `createSCLModuleR container name` creates a new empty SCL module under the specified `container` with the specified `name` and returns the created module's Resource. """ @JavaName createSCLModule createSCLModuleR :: Resource -> String -> Resource """ `createSCLScriptR container name` creates a new empty SCL script under the specified `container` with the specified `name` and returns the created script's Resource. """ @JavaName createSCLScript createSCLScriptR :: Resource -> String -> Resource """ `createPGraphR container name` creates a new empty partial graph ontology definition (PGraph) under the specified `container` with the specified `name` and returns the created ontology definition's Resource. """ @JavaName createPGraph createPGraphR :: Resource -> String -> Resource "`setSCLModuleDefinition module definition` sets the textual `definition` of the specified SCL `module`." setSCLModuleDefinition :: Resource -> String -> Resource "`setSCLScriptDefinition module definition` sets the textual `definition` of the specified SCL `module`." setSCLScriptDefinition :: Resource -> String -> Resource setPGraphDefinition :: Resource -> String -> Resource """ `createSCLModuleWithDefinition container name definition` creates a new SCL module under the specified `container` with the specified `name` and `definition` and returns the created module's Resource. """ createSCLModuleWithDefinition :: Resource -> String -> String -> Resource createSCLModuleWithDefinition container name definition = setSCLModuleDefinition (createSCLModuleR container name) definition """ `createSCLScriptWithDefinition container name definition` creates a new SCL script under the specified `container` with the specified `name` and `definition` and returns the created script's Resource. """ createSCLScriptWithDefinition :: Resource -> String -> String -> Resource createSCLScriptWithDefinition container name definition = setSCLScriptDefinition (createSCLScriptR container name) definition effect SCL "scl" "org.simantics.scl.compiler.commands.CommandSession" importJava "org.simantics.modeling.scl.SCLRealm" where data SCLRealm syncExec :: SCLRealm -> ( a) -> a @JavaName refreshVariablesSync refreshVariables :: SCLRealm -> () readSCLRealm :: Resource -> SCLRealm readSCLRealm r = let id = relatedValue r L0.HasName in match sclRealmById id with Just realm -> realm Nothing -> getOrCreateSCLRealm id importJava "org.simantics.modeling.scl.SCLSessionManager" where getOrCreateSCLRealm :: String -> SCLRealm sclRealmById :: String -> Maybe SCLRealm importJava "org.simantics.scl.compiler.top.CommandResponse" where data CommandResponse = @FieldNames [message, error] CommandResponse String Boolean isSuccessful :: CommandResponse -> Boolean isSuccessful (CommandResponse _ error) = not error instance Show CommandResponse where show (CommandResponse message _) = message importJava "org.simantics.scl.compiler.commands.CommandSession" where execute :: String -> () @JavaName getVariableValue variableValue :: String -> a setVariable :: String -> Type -> a -> ()