Simantics/Model module documentation

model :: String -> <ReadGraph> Resource
model name

Returns an existing model in the current project with the given name

configurationOf :: Resource -> <ReadGraph> Resource
configurationOf model

Returns the configuration of the given model and returns the configuration resource

allModels :: () -> <ReadGraph> [Resource]

Returns the list of all models in the current project.

getPossibleModel :: Resource -> <ReadGraph> Resource

Returns the model the given resource belongs to. The resource itself is returned if it is a model. Note that despite the return type this function produces a null resource when the resource does not belong to a model.

Undocumented entities

activateModel :: Resource -> <WriteGraph> Boolean

Activates the specified model but does not wait for any of the effects caused by the activation to be completed. In most cases the blocking version syncActivateModel should be used instead of this function.

activateModelAction :: Resource -> <Proc> ()

Activates the given model in a write transaction and discards the result. Like activateModel this does not wait for the effects of the activation to complete; use syncActivateModel when the completion matters.

copyAnnotationTypes :: Resource -> Resource -> <WriteGraph> ()

Copies annotation types from one model to another.

createGenericModel :: Resource -> String -> <WriteGraph> Resource

createGenericModel modelType name creates a new model of the given modelType with the given name in the current project and returns it. The new model gets a Configuration composite, its own cluster set and links to the ontologies the project requires. It is also activated if no other model in the project is active.

deleteIndex :: Resource -> <WriteGraph> ()

Deletes the dependency index of the given index root and invalidates the cached index queries that used it. The index is rebuilt from the contents of the index root when it is next needed. removeIndex does the same thing.

listIndexEntries :: Resource -> String -> <ReadGraph> String

listIndexEntries indexRoot query returns a human readable listing of the entries of the index of indexRoot that match the given index query, one line per entry with its name, type and resource. Intended for inspecting the contents of an index.

possibleIndexRoot :: Resource -> <ReadGraph> Maybe Resource

Returns the index root the given resource belongs to, or Nothing if the resource is not under one. An index root is a resource that has an index of its own, such as a model or a shared ontology.

releaseMemory :: () -> <WriteGraph> ()

Flushes the database client's cluster and query caches in order to release the memory they hold.

removeIndex :: Resource -> <WriteGraph> ()

Removes the index associated with the model.

resetIssueSources :: Resource -> <WriteGraph> ()

Updates all continuous issue sources of the model so that the issues they produce are recomputed against the current state of the database.

searchByQuery :: Resource -> String -> <ReadGraph> [Resource]

searchByQuery indexRoot query returns the resources that match the given index query. The query is a Lucene query over the indexed fields of the entities, such as Name:Pump*. The same indexes are searched as by searchByType.

searchByQueryShallow :: Resource -> String -> <ReadGraph> [Resource]

As searchByQuery but consults only the index of the given index root.

searchByType :: Resource -> Resource -> <ReadGraph> [Resource]

searchByType indexRoot type returns the resources of the given type that are indexed by indexRoot, by the index roots that indexRoot is linked to (L0.IsLinkedTo), and by the global ontologies.

The links are followed recursively: the index roots linked to a linked index root are consulted as well, to any depth. Each index root is consulted once however many paths reach it, so links that form a cycle neither repeat the search nor make it fail.

searchByTypeAndFilter :: Resource -> Resource -> (Resource -> <ReadGraph> Boolean) -> <ReadGraph> [Resource]

As searchByType but keeps only the resources for which the given filter returns True.

searchByTypeAndName :: Resource -> Resource -> String -> <ReadGraph> [Resource]

As searchByType but returns only the resources whose name is the given name.

searchByTypeAndNameShallow :: Resource -> Resource -> String -> <ReadGraph> [Resource]

As searchByTypeAndName but consults only the index of the given index root.

searchByTypeShallow :: Resource -> Resource -> <ReadGraph> [Resource]

As searchByType but consults only the index of the given index root, not the indexes of linked index roots or global ontologies.

syncActivateModel :: Resource -> <Proc> Boolean

Activates the specified model and blocks until all effects caused by the activation have been completed. This function is a synchronous version of the older activateModel function that does not wait for activation completion, i.e. works asynchronously. In most cases it is recommended to use this functions instead of

The effect completion waiting works based on the org.simantics.db.service.ServiceActivityMonitor service offered by the database client. Therefore implementation that want to support waiting for activation completion need to register/unregister activities with this service accordingly.