-include "Simantics/Entity" hiding (nameOf)\r
-include "Simantics/Ontologies"\r
-\r
-type Model = Resource\r
-type Configuration = Resource\r
-\r
-"""\r
- model name\r
- \r
-Returns an existing model in the current project with the given `name`\r
-"""\r
-model :: String -> <ReadGraph> Model\r
-model name = match possibleResourceChild (currentProject ()) name with\r
- Just m -> fromResource m\r
- Nothing -> fail $ "Didn't find a model " + name + "." \r
-\r
-"""\r
- configurationOf model\r
- \r
-Returns the configuration of the given `model`\r
-and returns the `configuration` resource\r
-"""\r
-configurationOf :: Model -> <ReadGraph> Configuration\r
-configurationOf m = do\r
- conf = singleObject (toResource m) SIMU.HasConfiguration \r
- fromResource conf\r
-\r
-"""\r
-Returns the list of all models in the current project.\r
-"""\r
-allModels :: () -> <ReadGraph> [Model]\r
-allModels _ = map fromResource $ objectsWithType (currentProject ()) L0.ConsistsOf SIMU.Model\r
-\r
-importJava "org.simantics.modeling.ModelingUtils" where\r
- """Removes the index associated with the model."""\r
- removeIndex :: Model -> <WriteGraph> ()\r
- \r
- resetIssueSources :: Model -> <WriteGraph> ()\r
- \r
- """Copies annotation types from one model to another."""\r
- copyAnnotationTypes :: Model -> Model -> <WriteGraph> ()\r
- \r
- deleteIndex :: Resource -> <WriteGraph> ()\r
- releaseMemory :: () -> <WriteGraph> ()\r
- \r
- searchByType :: Resource -> Resource -> <ReadGraph> [Resource]\r
- searchByTypeShallow :: Resource -> Resource -> <ReadGraph> [Resource]\r
- searchByTypeAndName :: Resource -> Resource -> String -> <ReadGraph> [Resource]\r
- searchByTypeAndNameShallow :: Resource -> Resource -> String -> <ReadGraph> [Resource]\r
- searchByQuery :: Resource -> String -> <ReadGraph> [Resource]\r
- searchByQueryShallow :: Resource -> String -> <ReadGraph> [Resource]\r
- searchByTypeAndFilter :: Resource -> Resource -> (Resource -> <ReadGraph> Boolean) -> <ReadGraph> [Resource]\r
- \r
- listIndexEntries :: Resource -> String -> <ReadGraph> String\r
- activateModel :: Resource -> <WriteGraph> Boolean\r
- \r
- @JavaName createModel\r
- createGenericModel :: Resource -> String -> <WriteGraph> Resource\r
-\r
-importJava "org.simantics.modeling.ModelingUtils" where\r
- @JavaName getPossibleModel\r
- getPossibleModel :: Resource -> <ReadGraph> Model\r
- possibleIndexRoot :: Resource -> <ReadGraph> Maybe Resource\r
-\r
-activateModelAction :: Resource -> <Proc> ()\r
-activateModelAction model = do\r
- syncWrite (\() -> activateModel model)\r
- ()\r
- \r
+include "Simantics/Entity" hiding (nameOf)
+include "Simantics/Ontologies"
+
+type Model = Resource
+type Configuration = Resource
+
+"""
+ model name
+
+Returns an existing model in the current project with the given `name`
+"""
+model :: String -> <ReadGraph> Model
+model name = match possibleResourceChild (currentProject ()) name with
+ Just m -> m
+ Nothing -> fail $ "Didn't find a model " + name + "."
+
+"""
+ configurationOf model
+
+Returns the configuration of the given `model`
+and returns the `configuration` resource
+"""
+configurationOf :: Model -> <ReadGraph> Configuration
+configurationOf m = singleObject m SIMU.HasConfiguration
+
+"""
+Returns the list of all models in the current project.
+"""
+allModels :: () -> <ReadGraph> [Model]
+allModels _ = objectsWithType (currentProject ()) L0.ConsistsOf SIMU.Model
+
+importJava "org.simantics.modeling.ModelingUtils" where
+ """Removes the index associated with the model."""
+ removeIndex :: Model -> <WriteGraph> ()
+
+ resetIssueSources :: Model -> <WriteGraph> ()
+
+ """Copies annotation types from one model to another."""
+ copyAnnotationTypes :: Model -> Model -> <WriteGraph> ()
+
+ deleteIndex :: Resource -> <WriteGraph> ()
+ releaseMemory :: () -> <WriteGraph> ()
+
+ searchByType :: Resource -> Resource -> <ReadGraph> [Resource]
+ searchByTypeShallow :: Resource -> Resource -> <ReadGraph> [Resource]
+ searchByTypeAndName :: Resource -> Resource -> String -> <ReadGraph> [Resource]
+ searchByTypeAndNameShallow :: Resource -> Resource -> String -> <ReadGraph> [Resource]
+ searchByQuery :: Resource -> String -> <ReadGraph> [Resource]
+ searchByQueryShallow :: Resource -> String -> <ReadGraph> [Resource]
+ searchByTypeAndFilter :: Resource -> Resource -> (Resource -> <ReadGraph> Boolean) -> <ReadGraph> [Resource]
+
+ listIndexEntries :: Resource -> String -> <ReadGraph> String
+ activateModel :: Resource -> <WriteGraph> Boolean
+
+ @JavaName createModel
+ createGenericModel :: Resource -> String -> <WriteGraph> Resource
+
+importJava "org.simantics.modeling.ModelingUtils" where
+ @JavaName getPossibleModel
+ getPossibleModel :: Resource -> <ReadGraph> Model
+ possibleIndexRoot :: Resource -> <ReadGraph> Maybe Resource
+
+activateModelAction :: Resource -> <Proc> ()
+activateModelAction model = do
+ syncWrite (\() -> activateModel model)
+ ()
+
\ No newline at end of file