1 include "Simantics/Entity" hiding (nameOf)
2 include "Simantics/Ontologies"
3 import "Simantics/Misc"
6 type Configuration = Resource
11 Returns an existing model in the current project with the given `name`
13 model :: String -> <ReadGraph> Model
14 model name = match possibleResourceChild (currentProject ()) name with
16 Nothing -> fail $ "Didn't find a model " + name + "."
21 Returns the configuration of the given `model`
22 and returns the `configuration` resource
24 configurationOf :: Model -> <ReadGraph> Configuration
25 configurationOf m = singleObject m SIMU.HasConfiguration
28 Returns the list of all models in the current project.
30 allModels :: () -> <ReadGraph> [Model]
31 allModels _ = objectsWithType (currentProject ()) L0.ConsistsOf SIMU.Model
33 importJava "org.simantics.modeling.ModelingUtils" where
34 """Removes the index associated with the model."""
35 removeIndex :: Model -> <WriteGraph> ()
37 resetIssueSources :: Model -> <WriteGraph> ()
39 """Copies annotation types from one model to another."""
40 copyAnnotationTypes :: Model -> Model -> <WriteGraph> ()
42 deleteIndex :: Resource -> <WriteGraph> ()
43 releaseMemory :: () -> <WriteGraph> ()
45 searchByType :: Resource -> Resource -> <ReadGraph> [Resource]
46 searchByTypeShallow :: Resource -> Resource -> <ReadGraph> [Resource]
47 searchByTypeAndName :: Resource -> Resource -> String -> <ReadGraph> [Resource]
48 searchByTypeAndNameShallow :: Resource -> Resource -> String -> <ReadGraph> [Resource]
49 searchByQuery :: Resource -> String -> <ReadGraph> [Resource]
50 searchByQueryShallow :: Resource -> String -> <ReadGraph> [Resource]
51 searchByTypeAndFilter :: Resource -> Resource -> (Resource -> <ReadGraph> Boolean) -> <ReadGraph> [Resource]
53 listIndexEntries :: Resource -> String -> <ReadGraph> String
56 Activates the specified model but does not wait for any of the effects
57 caused by the activation to be completed. In most cases the blocking
58 version [syncActivateModel](#syncActivateModel) should be used instead
61 activateModel :: Resource -> <WriteGraph> Boolean
64 createGenericModel :: Resource -> String -> <WriteGraph> Resource
66 importJava "org.simantics.modeling.ModelingUtils" where
67 @JavaName getPossibleModel
68 getPossibleModel :: Resource -> <ReadGraph> Model
69 possibleIndexRoot :: Resource -> <ReadGraph> Maybe Resource
71 activateModelAction :: Resource -> <Proc> ()
72 activateModelAction model = do
73 syncWrite (\() -> activateModel model)
77 Activates the specified model and blocks until all effects caused by the
78 activation have been completed. This function is a synchronous version of
79 the older [activateModel](#activateModel) function that does not wait for
80 activation completion, i.e. works asynchronously. In most cases it is
81 recommended to use this functions instead of
83 The effect completion waiting works based on the `org.simantics.db.service.ServiceActivityMonitor`
84 service offered by the database client. Therefore implementation that want
85 to support waiting for activation completion need to register/unregister
86 activities with this service accordingly.
88 syncActivateModel :: Resource -> <Proc> Boolean
89 syncActivateModel model = do
90 result = syncWrite (\() -> activateModel model)