-include "Simantics/Model"\r
-include "Simantics/DB"\r
-import "Simantics/DB" as DB\r
-\r
-importJava "java.lang.Object" where\r
- @JavaName equals\r
- """\r
-Function **variableEquals** compares the given input variables and returns True if they are the same.\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- my_variable_1 = moduleVariable "PO01"\r
- my_variable_2 = moduleVariable "PO02"\r
- variableEquals my_variable_1 my_variable_2\r
- \r
- > False\r
- \r
- """\r
- variableEquals :: Variable -> Variable -> Boolean\r
- @JavaName hashCode\r
- variableHash :: Variable -> Integer\r
-\r
-instance Eq Variable where\r
- (==) = variableEquals\r
- \r
-instance Hashable Variable where\r
- hashP = hashP . variableHash\r
-\r
-importJava "org.simantics.db.layer0.variable.Variables" where\r
- @JavaName getVariable\r
- """\r
-Function **variable** converts a variable URI to a variable.\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- model_id = model "Model"\r
- my_component = getComponent model_id "PO01"\r
- my_uri = uriOf my_component\r
- my_variable = variable my_uri\r
- my_variable\r
- \r
- > <variable>\r
- """\r
- variable :: String -> <ReadGraph> Variable\r
- \r
- @JavaName getVariable\r
- """\r
-Function **resourceVariable** converts a resource to a corresponding variable.\r
-\r
-Example:\r
- \r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- model_id = model "Model"\r
- my_resource = getComponent model_id "PO01"\r
- my_variable = resourceVariable my_resource\r
- my_variable\r
- \r
- > <variable>\r
- """\r
- resourceVariable :: Resource -> <ReadGraph> Variable\r
- \r
- @JavaName getModel\r
- """\r
-Function **modelOfVariable** returns the model, in which the given input variable is located, as **Resource**\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- my_variable = moduleVariable "PO01"\r
- my_model = modelOfVariable my_variable\r
- my_model\r
- \r
- > #376833\r
- \r
- // use function nameOf, which works for resources, to print out the name of the model\r
- nameOf(my_model)\r
- \r
- > "Model"\r
-\r
- """\r
- modelOfVariable :: Variable -> <ReadGraph> Model\r
-\r
- @JavaName getModel\r
- modelResourceOfVariable :: Variable -> <ReadGraph> Resource\r
- \r
- @JavaName possibleActiveVariable\r
- possibleActiveVariable :: Variable -> <ReadGraph> Maybe Variable\r
-\r
- @JavaName switchPossibleContext\r
- switchPossibleContext :: Variable -> Resource -> <ReadGraph> Maybe Variable\r
- \r
- @JavaName getIndexRoot\r
- instanceIndexRoot :: Variable -> <ReadGraph> Resource\r
- \r
- createValueAccessor :: (Variable -> <ReadGraph> a) -> (Variable -> Binding b -> <ReadGraph> b) -> (Variable -> c -> <WriteGraph> ()) -> (Variable -> d -> Binding d -> <WriteGraph> ()) -> (Variable -> <ReadGraph> Datatype) -> ValueAccessor\r
- \r
-importJava "org.simantics.db.layer0.function.All" where\r
-\r
- standardGetValue1 :: Variable -> <ReadGraph> a\r
- standardGetValue2 :: Variable -> Binding a -> <ReadGraph> a\r
- standardSetValue2 :: Variable -> a -> <WriteGraph> ()\r
- standardSetValue3 :: Variable -> a -> Binding a -> <WriteGraph> ()\r
- standardGetDatatype :: Variable -> <ReadGraph> Datatype\r
-\r
-importJava "org.simantics.db.layer0.variable.VariableMap" where\r
- data VariableMap\r
-\r
-importJava "org.simantics.db.layer0.variable.ValueAccessor" where\r
- data ValueAccessor\r
-\r
-importJava "org.simantics.db.layer0.variable.Variable" where\r
- data Variable\r
- \r
- @JavaName getProperties\r
- properties_ :: Variable -> <ReadGraph> Collection Variable\r
- \r
- @JavaName getProperties\r
- propertiesClassified_ :: Variable -> Resource -> <ReadGraph> Collection Variable\r
- \r
- @JavaName getChildren\r
- children_ :: Variable -> <ReadGraph> Collection Variable\r
- \r
- @JavaName getValue\r
- value_ :: Variable -> Binding a -> <ReadGraph> a\r
- \r
- @JavaName getDatatype\r
- datatype :: Variable -> <ReadGraph> Datatype\r
- \r
- @JavaName getValue\r
- untypedValue :: Variable -> <ReadGraph> a\r
- \r
- @JavaName getPossibleValue\r
- possibleVariableValue_ :: Variable -> Binding a -> <ReadGraph> Maybe a\r
- \r
- @JavaName getPossibleValue\r
- untypedPossibleVariableValue :: Variable -> <ReadGraph> Maybe a\r
- \r
- @private\r
- @JavaName getChild\r
- child_ :: Variable -> String -> <ReadGraph> Variable\r
- \r
- @private\r
- @JavaName getPossibleChild\r
- possibleChild_ :: Variable -> String -> <ReadGraph> Maybe Variable\r
-\r
- browse :: Variable -> String -> <ReadGraph> Variable\r
- browsePossible :: Variable -> String -> <ReadGraph> Maybe Variable\r
- \r
- @JavaName getProperty\r
- """\r
-Function **property** return the wanted property as **Variable**\r
-\r
-**Input 1:** Module which property we want to obtain as **Variable**\r
-\r
-**Input 2:** Name of the property as **String**\r
-\r
-**Output:** wanted property as **Variable**\r
-\r
-Example\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- my_property_variable = property (moduleVariable "PO01") "PO11_PRESSURE"\r
- my_property_variable\r
- \r
- > <variable>\r
- """\r
- property :: Variable -> String -> <ReadGraph> Variable\r
- \r
- @JavaName getPossibleProperty\r
- possibleProperty :: Variable -> String -> <ReadGraph> Maybe Variable\r
- \r
- @JavaName getPropertyValue\r
- propertyValue_ :: Variable -> String -> Binding a -> <ReadGraph> a\r
-\r
- @JavaName getPropertyValue\r
- untypedPropertyValue :: Variable -> String -> <ReadGraph> a\r
-\r
- @JavaName getPossiblePropertyValue\r
- possiblePropertyValue_ :: Variable -> String -> Binding a -> <ReadGraph> Maybe a\r
- \r
- @JavaName getPossiblePropertyValue\r
- untypedPossiblePropertyValue :: Variable -> String -> <ReadGraph> Maybe a\r
- \r
- @JavaName getName\r
-\r
- """\r
-Function **name** return the name of the input variable as string\r
-\r
-Example:\r
- \r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- name (moduleVariable "PO01")\r
- \r
- > "PO01"\r
- """\r
- \r
- name :: Variable -> <ReadGraph> String\r
- @JavaName getURI\r
- """\r
-Function **uri** return the uri of given variable. The uri is fetched from the active **Experiment**\r
-\r
-**Input 1:** wanted variable which uri is needed as **Variable**\r
-\r
-**Output:** uri of the variable as **String**\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- uri (moduleVariable "PO01")\r
-\r
- >"http://Projects/Development%20Project/Model/Experiment/8ee6b693-891b-438e-a597-9e15a2634e8b/NewGenericDiagram/PO01"\r
-\r
- """\r
- uri :: Variable -> <ReadGraph> String\r
- \r
- @JavaName getParent\r
- """\r
-Function **variableParent** returns the name of the parent variable as **Variable**\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- my_variable = moduleVariable "PO01"\r
- variableParent my_variable\r
- \r
- > <variable>\r
- \r
- name (variableParent my_variable)\r
-\r
- > "NewGenericDiagram"\r
- \r
- """\r
- variableParent :: Variable -> <ReadGraph> Variable\r
-\r
- @JavaName getRepresents\r
- \r
- """\r
-Function **represents** returns the resource of the given input variable\r
-\r
-**Input 1:** **Variable** which resource is wanted to be obtainend\r
-\r
-**Output:** **Resource** of the given input variable.\r
-\r
-Example: Find out the resource of given variable\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- represents (moduleVariable "PO01")\r
-\r
- > #426013\r
-\r
- """\r
- represents :: Variable -> <ReadGraph> Resource\r
- \r
- @JavaName getPossibleRepresents\r
- possibleRepresents :: Variable -> <ReadGraph> Maybe Resource\r
- \r
- @JavaName setValue\r
- setValue :: Variable -> a -> <WriteGraph> ()\r
- \r
- @JavaName setPropertyValue\r
- setPropertyValue_ :: Variable -> String -> a -> Binding a -> <WriteGraph> ()\r
- \r
- @JavaName getType\r
- """\r
-Function **getType** returns the type of the input variable as resource\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- getType (moduleVariable "PO01")\r
- \r
- > #275837\r
- \r
- nameOf(getType (moduleVariable "PO01"))\r
- \r
- > "POINT_QF"\r
- """\r
- getType :: Variable -> <ReadGraph> Resource\r
- \r
- @JavaName getPossibleType\r
- getPossibleType :: Variable -> <ReadGraph> Maybe Resource\r
- \r
- getPredicateResource :: Variable -> <ReadGraph> Resource\r
- \r
- getIndexRoot :: Variable -> <ReadGraph> Resource\r
-\r
-value :: Serializable a => Typeable a => Variable -> <ReadGraph> a\r
-value var = value_ var binding \r
-\r
-possibleVariableValue :: Serializable a => Typeable a => Variable -> <ReadGraph> Maybe a\r
-possibleVariableValue var = possibleVariableValue_ var binding \r
-\r
-"""\r
-Function **propertyValue** finds the value of given property.\r
-\r
-Example: Find out the value of point PO01 attribute PO11_PRESSURE\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- propertyValue (moduleVariable "PO01") "PO11_PRESSURE" :: Double\r
-\r
- > 0.75\r
-\r
-"""\r
-\r
-propertyValue :: Serializable a => Typeable a => Variable -> String -> <ReadGraph> a\r
-propertyValue var prop = propertyValue_ var prop binding\r
-\r
-possiblePropertyValue :: Serializable a => Typeable a => Variable -> String -> <ReadGraph> Maybe a\r
-possiblePropertyValue var prop = possiblePropertyValue_ var prop binding\r
-\r
-"""\r
-Function **setPropertyValue** sets wanted to value to given Variable property.\r
-\r
-**Input 1:** Wanted module as **Variable**\r
-\r
-**Input 2:** Wanted property name as **String**\r
-\r
-**Output:** No output, given value is inserted to property \r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- setPropertyValue (moduleVariable "PO01") "PO11_PRESSURE" 0.5\r
-"""\r
-\r
-setPropertyValue :: Serializable a => Variable -> String -> a -> <WriteGraph> ()\r
-setPropertyValue subject prediate value = setPropertyValue_ subject prediate value binding\r
-\r
-"""\r
-Function **modelVariableOfVariable** returns the model, in which the given input Variable is located, as **Variable**\r
-\r
-Example:\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- my_model_variable = modelVariableOfVariable (moduleVariable "PO01")\r
- my_model_variable\r
-\r
- > <variable>\r
- \r
- name my_model_variable\r
- \r
- > "Model"\r
-"""\r
-\r
-modelVariableOfVariable :: Variable -> <ReadGraph> Variable \r
-modelVariableOfVariable var = variable $ uriOf $ toResource $ modelOfVariable var\r
-\r
-uniqueChild :: Model -> Resource -> String -> <ReadGraph> Variable\r
-uniqueChild model typet childName = do\r
- typeName = DB.nameOf typet\r
- query = "Types: " + typeName + " AND Name: " + childName\r
- moduleResources = searchByQuery (toResource model) query\r
- variable $ uriOf $ moduleResources ! 0\r
-\r
-"""\r
-Function **properties** returns a list, which contains of the properties of the input variable as **Variable**\r
-\r
-Example 1: print out all the properties of certain point as they are shown in Variable Debugger.\r
- \r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- point_properties_list = properties (moduleVariable "PO01")\r
- //print out the names of the properties\r
- for point_properties_list (\x -> print(name x) )\r
- \r
- > IncludedInSimulation\r
- > PO11_PRESSURE\r
- > IsDesynchronized\r
- > PO11_PROPERTY_CALC\r
- > PO11_EPM_ROU\r
- > PO11_ELEV_FROM_BOT\r
- ...\r
-\r
-Example 2: print out only the properties of a point, which name starts as "PO11". Else do nothing.\r
-\r
- import "Simantics/Variables"\r
- import "Apros/Module"\r
- point_properties_list = properties (moduleVariable "PO01")\r
- for point_properties_list (\x -> do\r
- //print out the names of the properties, which name start as "PO11"\r
- if (take 4 (name x) == "PO11") then do\r
- print(name x)\r
- ()\r
- else do\r
- ()\r
- )\r
- \r
- > PO11_PRESSURE\r
- > PO11_PROPERTY_CALC\r
- > PO11_EPM_ROU\r
- > PO11_ELEV_FROM_BOT\r
- > PO11_NODE_VELOCITY_CALC\r
- ...\r
-\r
-"""\r
-properties = collectionToList . properties_\r
-\r
-instance Show Variable where\r
- show _ = "<variable>"\r
- \r
-instance Browsable Variable where\r
- fromUri = variable\r
- uriOf = uri\r
- nameOf = name\r
- possibleNameOf v = Just (name v)\r
- children v = collectionToList (children_ v)\r
- parent = variableParent\r
- possibleParent v = Just (variableParent v)\r
- valueOf v = untypedValue v\r
- variantValueOf v = createVariant (datatype v) (untypedValue v :: Dynamic)\r
- child = child_\r
- possibleChild = possibleChild_\r
-\r
-propertiesClassified :: Variable -> Resource -> <ReadGraph> [Variable]\r
-propertiesClassified parent classified = do\r
- collectionToList $ propertiesClassified_ parent classified
\ No newline at end of file
+/*******************************************************************************
+ * Copyright (c) 2019 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Semantum Oy - initial API and implementation
+ *******************************************************************************/
+include "Simantics/Model"
+include "Simantics/DB"
+import "Simantics/DB" as DB
+
+importJava "org.simantics.db.layer0.variable.Variables" where
+ @JavaName getVariable
+ """
+Function **variable** converts a variable URI to a variable.
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ model_id = model "Model"
+ my_component = getComponent model_id "PO01"
+ my_uri = uriOf my_component
+ my_variable = variable my_uri
+ my_variable
+
+ > <variable>
+ """
+ variable :: String -> <ReadGraph> Variable
+
+ @JavaName getPossibleVariable
+ possibleResourceVariable :: Resource -> <ReadGraph> Maybe Variable
+
+ @JavaName getPossibleVariable
+ possibleVariable :: String -> <ReadGraph> Maybe Variable
+
+ @JavaName getVariable
+ """
+Function **resourceVariable** converts a resource to a corresponding variable.
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ model_id = model "Model"
+ my_resource = getComponent model_id "PO01"
+ my_variable = resourceVariable my_resource
+ my_variable
+
+ > <variable>
+ """
+ resourceVariable :: Resource -> <ReadGraph> Variable
+
+ @JavaName getModel
+ """
+Function **modelOfVariable** returns the model, in which the given input variable is located, as **Resource**
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ my_variable = moduleVariable "PO01"
+ my_model = modelOfVariable my_variable
+ my_model
+
+ > #376833
+
+ // use function nameOf, which works for resources, to print out the name of the model
+ nameOf(my_model)
+
+ > "Model"
+
+ """
+ modelOfVariable :: Variable -> <ReadGraph> Model
+
+ @JavaName getModel
+ modelResourceOfVariable :: Variable -> <ReadGraph> Resource
+
+ @JavaName possibleActiveVariable
+ possibleActiveVariable :: Variable -> <ReadGraph> Maybe Variable
+
+ @JavaName switchPossibleContext
+ switchPossibleContext :: Variable -> Resource -> <ReadGraph> Maybe Variable
+
+ @JavaName getIndexRoot
+ instanceIndexRoot :: Variable -> <ReadGraph> Resource
+
+ createValueAccessor :: (Variable -> <ReadGraph> a) -> (Variable -> Binding b -> <ReadGraph> b) -> (Variable -> c -> <WriteGraph> ()) -> (Variable -> d -> Binding d -> <WriteGraph> ()) -> (Variable -> <ReadGraph> Datatype) -> ValueAccessor
+
+ @JavaName getConfigurationContext
+ possibleConfigurationContext :: Resource -> <ReadGraph> Variable
+
+ setRVIProperty :: Variable -> RVI -> <WriteGraph> ()
+
+importJava "org.simantics.db.layer0.function.All" where
+
+ standardGetValue1 :: Variable -> <ReadGraph> a
+ standardGetValue2 :: Variable -> Binding a -> <ReadGraph> a
+ standardSetValue2 :: Variable -> a -> <WriteGraph> ()
+ standardSetValue3 :: Variable -> a -> Binding a -> <WriteGraph> ()
+ standardGetDatatype :: Variable -> <ReadGraph> Datatype
+
+importJava "org.simantics.db.layer0.variable.VariableMap" where
+ data VariableMap
+
+importJava "org.simantics.db.layer0.variable.StructuredProperty" where
+ data StructuredProperty
+
+importJava "org.simantics.db.layer0.variable.ResourceCollectionVariableMap" where
+ @JavaName "<init>"
+ createVariableMap :: [Resource] -> VariableMap
+
+importJava "org.simantics.db.layer0.variable.ValueAccessor" where
+ data ValueAccessor
+
+importJava "org.simantics.db.layer0.variable.Variable" where
+ data Variable
+
+ @JavaName getRVI
+ rviOf :: Variable -> <ReadGraph> RVI
+
+ @JavaName getProperties
+ properties_ :: Variable -> <ReadGraph> Collection Variable
+
+ @JavaName getProperties
+ propertiesClassified_ :: Variable -> Resource -> <ReadGraph> Collection Variable
+
+ @JavaName getChildren
+ children_ :: Variable -> <ReadGraph> Collection Variable
+
+ @JavaName getValue
+ value_ :: Variable -> Binding a -> <ReadGraph> a
+
+ @JavaName getDatatype
+ datatype :: Variable -> <ReadGraph> Datatype
+
+ @JavaName getValue
+ untypedValue :: Variable -> <ReadGraph> a
+
+ @JavaName getPossibleValue
+ possibleVariableValue_ :: Variable -> Binding a -> <ReadGraph> Maybe a
+
+ @JavaName getPossibleValue
+ untypedPossibleVariableValue :: Variable -> <ReadGraph> Maybe a
+
+ @private
+ @JavaName getChild
+ child_ :: Variable -> String -> <ReadGraph> Variable
+
+ @private
+ @JavaName getPossibleChild
+ possibleChild_ :: Variable -> String -> <ReadGraph> Maybe Variable
+
+ browse :: Variable -> String -> <ReadGraph> Variable
+ browsePossible :: Variable -> String -> <ReadGraph> Maybe Variable
+
+ @JavaName getProperty
+ """
+Function **property** return the wanted property as **Variable**
+
+**Input 1:** Module which property we want to obtain as **Variable**
+
+**Input 2:** Name of the property as **String**
+
+**Output:** wanted property as **Variable**
+
+Example
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ my_property_variable = property (moduleVariable "PO01") "PO11_PRESSURE"
+ my_property_variable
+
+ > <variable>
+ """
+ property :: Variable -> String -> <ReadGraph> Variable
+
+ @JavaName getPossibleProperty
+ possibleProperty :: Variable -> String -> <ReadGraph> Maybe Variable
+
+ @JavaName getPropertyValue
+ propertyValue_ :: Variable -> String -> Binding a -> <ReadGraph> a
+
+ @JavaName getPropertyValue
+ untypedPropertyValue :: Variable -> String -> <ReadGraph> a
+
+ @JavaName getPossiblePropertyValue
+ possiblePropertyValue_ :: Variable -> String -> Binding a -> <ReadGraph> Maybe a
+
+ @JavaName getPossiblePropertyValue
+ untypedPossiblePropertyValue :: Variable -> String -> <ReadGraph> Maybe a
+
+ @JavaName getName
+
+ """
+Function **name** return the name of the input variable as string
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ name (moduleVariable "PO01")
+
+ > "PO01"
+ """
+
+ name :: Variable -> <ReadGraph> String
+ @JavaName getURI
+ """
+Function **uri** return the uri of given variable. The uri is fetched from the active **Experiment**
+
+**Input 1:** wanted variable which uri is needed as **Variable**
+
+**Output:** uri of the variable as **String**
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ uri (moduleVariable "PO01")
+
+ >"http://Projects/Development%20Project/Model/Experiment/8ee6b693-891b-438e-a597-9e15a2634e8b/NewGenericDiagram/PO01"
+
+ """
+ uri :: Variable -> <ReadGraph> String
+
+ @JavaName getParent
+ """
+Function **variableParent** returns the name of the parent variable as **Variable**
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ my_variable = moduleVariable "PO01"
+ variableParent my_variable
+
+ > <variable>
+
+ name (variableParent my_variable)
+
+ > "NewGenericDiagram"
+
+ """
+ variableParent :: Variable -> <ReadGraph> Variable
+
+ @JavaName getRepresents
+
+ """
+Function **represents** returns the resource of the given input variable
+
+**Input 1:** **Variable** which resource is wanted to be obtainend
+
+**Output:** **Resource** of the given input variable.
+
+Example: Find out the resource of given variable
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ represents (moduleVariable "PO01")
+
+ > #426013
+
+ """
+ represents :: Variable -> <ReadGraph> Resource
+
+ @JavaName getPossibleRepresents
+ possibleRepresents :: Variable -> <ReadGraph> Maybe Resource
+
+ @JavaName setValue
+ setValue :: Variable -> a -> <WriteGraph> ()
+
+ @JavaName setPropertyValue
+ setPropertyValue_ :: Variable -> String -> a -> Binding a -> <WriteGraph> ()
+
+ @JavaName getType
+ """
+Function **getType** returns the type of the input variable as resource
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ getType (moduleVariable "PO01")
+
+ > #275837
+
+ nameOf(getType (moduleVariable "PO01"))
+
+ > "POINT_QF"
+ """
+ getType :: Variable -> <ReadGraph> Resource
+
+ @JavaName getPossibleType
+ getPossibleType :: Variable -> <ReadGraph> Maybe Resource
+
+ getPredicateResource :: Variable -> <ReadGraph> Resource
+
+ getIndexRoot :: Variable -> <ReadGraph> Resource
+
+value :: Serializable a => Typeable a => Variable -> <ReadGraph> a
+value var = value_ var binding
+
+possibleVariableValue :: Serializable a => Typeable a => Variable -> <ReadGraph> Maybe a
+possibleVariableValue var = possibleVariableValue_ var binding
+
+"""
+Function **propertyValue** finds the value of given property.
+
+Example: Find out the value of point PO01 attribute PO11_PRESSURE
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ propertyValue (moduleVariable "PO01") "PO11_PRESSURE" :: Double
+
+ > 0.75
+
+"""
+
+propertyValue :: Serializable a => Typeable a => Variable -> String -> <ReadGraph> a
+propertyValue var prop = propertyValue_ var prop binding
+
+possiblePropertyValue :: Serializable a => Typeable a => Variable -> String -> <ReadGraph> Maybe a
+possiblePropertyValue var prop = possiblePropertyValue_ var prop binding
+
+"""
+Function **setPropertyValue** sets wanted to value to given Variable property.
+
+**Input 1:** Wanted module as **Variable**
+
+**Input 2:** Wanted property name as **String**
+
+**Output:** No output, given value is inserted to property
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ setPropertyValue (moduleVariable "PO01") "PO11_PRESSURE" 0.5
+"""
+
+setPropertyValue :: Serializable a => Variable -> String -> a -> <WriteGraph> ()
+setPropertyValue subject prediate value = setPropertyValue_ subject prediate value binding
+
+"""
+Function **modelVariableOfVariable** returns the model, in which the given input Variable is located, as **Variable**
+
+Example:
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ my_model_variable = modelVariableOfVariable (moduleVariable "PO01")
+ my_model_variable
+
+ > <variable>
+
+ name my_model_variable
+
+ > "Model"
+"""
+
+modelVariableOfVariable :: Variable -> <ReadGraph> Variable
+modelVariableOfVariable var = variable $ uriOf $ modelOfVariable var
+
+uniqueChild :: Model -> Resource -> String -> <ReadGraph> Variable
+uniqueChild model typet childName = do
+ typeName = DB.nameOf typet
+ query = "Types: " + typeName + " AND Name: " + childName
+ moduleResources = searchByQuery model query
+ variable $ uriOf $ moduleResources ! 0
+
+"""
+Function **properties** returns a list, which contains of the properties of the input variable as **Variable**
+
+Example 1: print out all the properties of certain point as they are shown in Variable Debugger.
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ point_properties_list = properties (moduleVariable "PO01")
+ //print out the names of the properties
+ for point_properties_list (\x -> print(name x) )
+
+ > IncludedInSimulation
+ > PO11_PRESSURE
+ > IsDesynchronized
+ > PO11_PROPERTY_CALC
+ > PO11_EPM_ROU
+ > PO11_ELEV_FROM_BOT
+ ...
+
+Example 2: print out only the properties of a point, which name starts as "PO11". Else do nothing.
+
+ import "Simantics/Variables"
+ import "Apros/Module"
+ point_properties_list = properties (moduleVariable "PO01")
+ for point_properties_list (\x -> do
+ //print out the names of the properties, which name start as "PO11"
+ if (take 4 (name x) == "PO11") then do
+ print(name x)
+ ()
+ else do
+ ()
+ )
+
+ > PO11_PRESSURE
+ > PO11_PROPERTY_CALC
+ > PO11_EPM_ROU
+ > PO11_ELEV_FROM_BOT
+ > PO11_NODE_VELOCITY_CALC
+ ...
+
+"""
+properties = collectionToList . properties_
+
+instance Show Variable where
+ show _ = "<variable>"
+
+instance Browsable Variable where
+ fromUri = variable
+ uriOf = uri
+ possibleUriOf v = Just (uri v)
+ nameOf = name
+ possibleNameOf v = Just (name v)
+ children v = collectionToList (children_ v)
+ parent = variableParent
+ possibleParent v = Just (variableParent v)
+ valueOf v = untypedValue v
+ variantValueOf v = createVariant (datatype v) (untypedValue v :: Dynamic)
+ child = child_
+ possibleChild = possibleChild_
+
+ genericRelatedValue v rel = untypedPropertyValue v (nameOf rel)
+ genericPossibleRelatedValue v rel = untypedPossiblePropertyValue v (nameOf rel)
+
+propertiesClassified :: Variable -> Resource -> <ReadGraph> [Variable]
+propertiesClassified parent classified = do
+ collectionToList $ propertiesClassified_ parent classified
+
+importJava "org.simantics.db.layer0.variable.RVI" where
+ data RVI
+
+ resolvePossible :: RVI -> Variable -> <ReadGraph> Maybe Variable
+
+instantiateUnder :: Resource -> Resource -> <WriteGraph> Resource
+instantiateUnder container typeToInstantiate = do
+ fn = (resourceVariable typeToInstantiate)#methods#instantiateUnder :: Resource -> Resource -> <WriteGraph> Resource
+ fn container typeToInstantiate
+
+@JavaType "org.simantics.db.layer0.variable.VariableOrResource"
+data VariableOrResource =
+ @JavaType "org.simantics.db.layer0.variable.ResourceX"
+ @FieldNames [value]
+ ResourceX Resource
+ | @JavaType "org.simantics.db.layer0.variable.VariableX"
+ @FieldNames [value]
+ VariableX Variable
+
+
\ No newline at end of file