1 include "Simantics/Entity" hiding (nameOf)
\r
2 include "Simantics/Ontologies"
\r
4 type Model = Resource
\r
5 type Configuration = Resource
\r
10 Returns an existing model in the current project with the given `name`
\r
12 model :: String -> <ReadGraph> Model
\r
13 model name = match possibleResourceChild (currentProject ()) name with
\r
14 Just m -> fromResource m
\r
15 Nothing -> fail $ "Didn't find a model " + name + "."
\r
18 configurationOf model
\r
20 Returns the configuration of the given `model`
\r
21 and returns the `configuration` resource
\r
23 configurationOf :: Model -> <ReadGraph> Configuration
\r
24 configurationOf m = do
\r
25 conf = singleObject (toResource m) SIMU.HasConfiguration
\r
29 Returns the list of all models in the current project.
\r
31 allModels :: () -> <ReadGraph> [Model]
\r
32 allModels _ = map fromResource $ objectsWithType (currentProject ()) L0.ConsistsOf SIMU.Model
\r
34 importJava "org.simantics.modeling.ModelingUtils" where
\r
35 """Removes the index associated with the model."""
\r
36 removeIndex :: Model -> <WriteGraph> ()
\r
38 resetIssueSources :: Model -> <WriteGraph> ()
\r
40 """Copies annotation types from one model to another."""
\r
41 copyAnnotationTypes :: Model -> Model -> <WriteGraph> ()
\r
43 deleteIndex :: Resource -> <WriteGraph> ()
\r
44 releaseMemory :: () -> <WriteGraph> ()
\r
46 searchByType :: Resource -> Resource -> <ReadGraph> [Resource]
\r
47 searchByTypeShallow :: Resource -> Resource -> <ReadGraph> [Resource]
\r
48 searchByTypeAndName :: Resource -> Resource -> String -> <ReadGraph> [Resource]
\r
49 searchByTypeAndNameShallow :: Resource -> Resource -> String -> <ReadGraph> [Resource]
\r
50 searchByQuery :: Resource -> String -> <ReadGraph> [Resource]
\r
51 searchByQueryShallow :: Resource -> String -> <ReadGraph> [Resource]
\r
52 searchByTypeAndFilter :: Resource -> Resource -> (Resource -> <ReadGraph> Boolean) -> <ReadGraph> [Resource]
\r
54 listIndexEntries :: Resource -> String -> <ReadGraph> String
\r
55 activateModel :: Resource -> <WriteGraph> Boolean
\r
57 @JavaName createModel
\r
58 createGenericModel :: Resource -> String -> <WriteGraph> Resource
\r
60 importJava "org.simantics.modeling.ModelingUtils" where
\r
61 @JavaName getPossibleModel
\r
62 getPossibleModel :: Resource -> <ReadGraph> Model
\r
63 possibleIndexRoot :: Resource -> <ReadGraph> Maybe Resource
\r
65 activateModelAction :: Resource -> <Proc> ()
\r
66 activateModelAction model = do
\r
67 syncWrite (\() -> activateModel model)
\r