Simantics/SCL

This module contains functions closely related to SCL and storing SCL related constructs in the Simantics database.

SCL Command Session

data CommandResponse
CommandResponse :: String -> Boolean -> CommandResponse
createTextAndErrors :: String -> [CompilationError] -> TextAndErrors
execute :: String -> <SCL,Proc> ()
isSuccessful :: CommandResponse -> Boolean

SCL Realm

getOrCreateSCLRealm :: String -> <Proc> SCLRealm
readSCLRealm :: Resource -> <ReadGraph,Proc> SCLRealm
refreshVariables :: SCLRealm -> <Proc> ()
sclRealmById :: String -> <Proc> Maybe SCLRealm
syncExec :: SCLRealm -> <SCL,Proc> a -> <Proc> a

Command Session Variable Access

setVariable :: String -> Type -> a -> <SCL> ()
variableValue :: String -> <SCL> a

SCL Values

createSCLValue :: Resource -> Resource -> Resource -> String -> <WriteGraph> Resource
createSCLValueIndependent :: Resource -> String -> <WriteGraph> Resource
setExpression :: Variable -> String -> <WriteGraph> ()

SCL Modules

createSCLModuleAction :: Resource -> <Proc> ()
createSCLModuleDefault :: Resource -> <WriteGraph> ()
createSCLModule :: Resource -> String -> <WriteGraph> ()

Use createSCLModuleR instead.

createSCLModuleR :: Resource -> String -> <WriteGraph> Resource

createSCLModuleR container name creates a new empty SCL module under the specified container with the specified name and returns the created module's Resource.

createSCLModuleWithDefinition :: Resource -> String -> String -> <WriteGraph> 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.

setSCLModuleDefinition :: Resource -> String -> <WriteGraph> Resource

setSCLModuleDefinition module definition sets the textual definition of the specified SCL module.

SCL Scripts

createSCLScriptAction :: Resource -> <Proc> ()
createSCLScriptDefault :: Resource -> <WriteGraph> ()
createSCLScript :: Resource -> String -> <WriteGraph> ()

Use createSCLScriptR instead.

createSCLScriptR :: Resource -> String -> <WriteGraph> 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.

createSCLScriptWithDefinition :: Resource -> String -> String -> <WriteGraph> Resource

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.

executeSCLScript :: Resource -> <Proc,Exception> ()

Shorthand for ignore $ getFutureResult (executeSCLScriptF script) to execute an SCL script and wait until the execution completes or fails without returning anything.

Before Simantics 1.52.0 this function only used to schedule the script execution like executeSCLScriptF but was changed to wait until the script execution finishes because the original behavior made no sense in under any real circumstances. The old behavior can be mimicked using ignore $ executeSCLScriptF script.

executeSCLScript will immediately raise an exception if invoked from within a database transaction. This is done avoid to avoid some potential deadlock circumstances.

executeSCLScriptF :: Resource -> <Proc> Future String

executeSCLScriptF scriptResource starts the execution of the SCL script stored in the configuration database as scriptResource.

The function only schedules the script execution and returns immediately with a Future String that can be waited upon to block until the execution finishes or fails. The String return value from the future contains information

The output of the script will be delegated primarily to the reporting handler attached to the current SCL execution context.

Secondarily, if the platform UI workbench is running, output will be pushed to SCL Script Output view.

Otherwise output will be pushed to the default logging reporter.

executeSCLScriptF will immediately raise an exception if invoked from within a database transaction. This is done avoid to avoid some potential deadlock circumstances.

setSCLScriptDefinition :: Resource -> String -> <WriteGraph> Resource

setSCLScriptDefinition module definition sets the textual definition of the specified SCL module.

Ontology definitions (PGraphs)

PGraph (partial graph) is a textual format for specifying ontologies for Simantics. For more information on the format, see this documentation.

createPGraphAction :: Resource -> <Proc> ()
createPGraphDefault :: Resource -> <WriteGraph> ()
createPGraph :: Resource -> String -> <WriteGraph> ()

Use createPGraphR instead.

createPGraphR :: Resource -> String -> <WriteGraph> 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.

setPGraphDefinition :: Resource -> String -> <WriteGraph> Resource