DB support module documentation

clusterSetAuditCounters :: () -> <ReadGraph> String

The session's counters of the commit-time cluster set audit, which checks each write's new resources against their nearest owner's cluster set, as name=count pairs separated by spaces: writes, resources, placed, misplaced, ownerOutside, unowned, ambiguous, ownerInNoSet, failedWrites, errors, millis (the time spent auditing).

clusterUIDOfResource :: Resource -> <ReadGraph> ClusterUID

Returns the UID of the cluster that stores the given resource.

collectClusters :: <Proc> ()

Releases as many cached clusters from memory as possible. The clusters are loaded again from the database when they are next needed.

countQueries :: <ReadGraph> Integer

Returns the number of queries currently held in the query cache.

directStatements :: Resource -> Boolean -> <ReadGraph> [Statement]

Returns the statements stored directly on the given resource, bypassing inference and the query cache. When the second argument is True only persistent statements are returned, otherwise virtual statements are included as well.

domainSetImmutabilities :: [Resource] -> Boolean -> <WriteGraph> ()

Sets the immutability of the cluster sets owned by the given roots, as one operation: domainSetImmutability for each. Roots that own no cluster set are logged and left alone.

domainSetImmutability :: Resource -> Boolean -> <WriteGraph> ()

Sets the immutability of the cluster set that the given resource owns, for example a whole model or ontology: of every cluster in it, and of the set, which then vouches that its clusters are immutable. Clusters of other cluster sets are left to their owners. A resource that owns no cluster set is left as it is, and logged. It walks no domain: the set says which clusters are the resource's. Requires a write transaction.

dumpHeap :: String -> <Proc> ()

Writes a heap dump of the running JVM to the given file path, in the HPROF format that memory analysers read. Only live objects are dumped. Every failure is swallowed, so an unwritable path produces neither a dump nor a complaint.

emptyTrashBinWithMonitor :: ProgressMonitor -> <Proc> ()

Permanently deletes everything in the trash bin of the current project, reporting progress to the given monitor.

flushQueries :: QueryControl -> <Proc> Integer
garbageResources :: <ReadGraph> [Resource]

Returns the resources that are no longer reachable from the root library, that is, the ones the database still holds but nothing refers to.

This walks every resource of every cluster in the database, collects all of their direct statements and then iterates a reachability fixpoint over them. It is a whole-database diagnostic and is correspondingly slow.

getQueryControl :: () -> <Proc> QueryControl
invalidateQueries :: QueryControl -> <WriteGraph> ()
isClusterLoaded :: ClusterUID -> <ReadGraph> Boolean

Tells whether the given cluster is currently loaded in memory. Does not load it.

isImmutableClusterSet :: Resource -> <ReadGraph> Boolean

Whether the cluster set the given resource owns vouches that every one of its clusters is immutable: the whole set was made immutable, and no mutable cluster has joined it since. False is no guarantee either way. Loads no cluster.

listClusters :: <ReadGraph> [ClusterUID]

Returns the UIDs of all clusters that the database server knows about.

mergeSources :: Resource -> TransferableGraphSource -> TransferableGraphSource -> <WriteGraph> ()

Modifies the resource given as the first argument so that its content matches the graph read from the second argument, using the third argument as the current state of the target. Requires a write transaction.

modelTransferableGraphSource :: TransferableGraphConfiguration2 -> <ReadGraph> TransferableGraphSource

Opens a transferable graph source over the content described by the given configuration.

possibleClusterSetOf :: Resource -> <ReadGraph> Maybe Resource

The resource owning the cluster set of the given resource's cluster. Immutability is a property of a cluster, and a cluster belongs to a cluster set, so this is what such an operation really acts on.

printStack :: () -> <Proc> ()

Prints the current Java stack trace to the SCL console, or to the log if there is no console. For finding out where a piece of SCL code is being run from.

resourcesByCluster :: ClusterUID -> <ReadGraph> [Resource]

Returns the resources that exist in the given cluster. Every resource index the cluster can hold is probed, so the cost is proportional to the capacity of the cluster rather than to the number of resources in it, and the cluster is loaded if it was not loaded already.

restrictQueries :: Integer -> Integer -> Integer -> <ReadGraph> ()

restrictQueries amount step maxTimeInMs

Collects some DB queries. Tries to reach at maximum 'amount' queries. Uses at maximum 'maxTimeInMs' milliseconds in 'step' millisecond stints.

serviceMode :: () -> <Proc> String

The service mode of the caller's writes, as text: inside a write that write's, otherwise the one the calling thread's next write takes. Set and restored by hand, so a method that leaves it on changes every later write the same thread requests.

setImmutable :: Resource -> Boolean -> <ReadGraph> ()

Sets the immutable flag of the cluster that the given resource belongs to. The flag applies to the whole cluster, not to the single resource. Writing to an immutable cluster fails unless it is done inside withServiceMode True.

tgConfigurer :: Boolean -> Boolean -> <ReadGraph> TGConfigurer

Creates a transferable graph configuration builder. The first argument leaves virtual resources out of the export, the second enables validation of the external references found while the export is produced.

tgConfigurerCreate :: TGConfigurer -> TransferableGraphConfiguration2

Builds the transferable graph configuration from the roots and exclusions accumulated in the builder.

tgConfigurerExclusions :: TGConfigurer -> [Resource] -> <Proc> TGConfigurer

Marks the given resources as excluded, so that the export refers to them from the outside instead of including them.

tgConfigurerRoots :: TGConfigurer -> [Resource] -> <ReadGraph> TGConfigurer

Adds the given resources as export roots. Each root is exported together with everything it owns, and its own name literal is excluded.

withServiceMode :: Boolean -> Boolean -> (() -> <b> a) -> <b> a
withServiceMode allowImmutableWrites createAsImmutable fn

runs function fn so that:

  • when allowImmutableWrites is True, fn is allowed to write to immutable clusters
  • when createAsImmutable is True, any new database clusters created by fn will be immutable

The mode applies to the writes fn makes: those it requests from this thread, and inside a write transaction that write. Other writes of the session, another user's or a job's, are not affected, and neither are writes fn leaves to other threads.