|
Contents
DB module documentationdata Resource A resource is a node in a semantic graph. ReadingURIsresource :: String -> <ReadGraph> Resource Converts an absolute URI to a resource possibleResource :: String -> <ReadGraph> Maybe Resource Converts an absolute URI to a resource or returns relativeResource :: Resource -> String -> <ReadGraph> Resource Converts a relative URI to a resource starting from the given resource Graph hierarchyclass Browsable a Things that are addressed by URI and browsed as a tree of named children. Both
Resource and fromUri :: Browsable a => String -> <ReadGraph> a Returns the value at the given absolute URI. Fails if there is nothing at that URI. uriOf :: Browsable a => a -> <ReadGraph> String Returns the URI of the given value. possibleUriOf :: Browsable a => a -> <ReadGraph> Maybe String Returns the URI of the given value if it exists or Nothing. nameOf :: Browsable a => a -> <ReadGraph> String Reads the name of the value. possibleNameOf :: Browsable a => a -> <ReadGraph> Maybe String Reads the name of the value or Nothing if it has no name. valueOf :: Browsable a => Serializable b => a -> <ReadGraph> b Reads the value the given entity holds, deserialized with the binding of the expected type. Fails if the entity holds no value. genericRelatedValue :: Browsable a => a -> Resource -> <ReadGraph> b Reads the value related to the given entity with the given relation. For a resource this is the value of the object of that relation, for a variable the value of the property named after the relation. Fails if there is no such value. genericPossibleRelatedValue :: Browsable a => a -> Resource -> <ReadGraph> Maybe b As genericRelatedValue but returns variantValueOf :: Browsable a => a -> <ReadGraph> Variant Reads the value the given entity holds as a children :: Browsable a => a -> <ReadGraph> [a] Returns the children of the given entity. For a resource these are the resources it consists of. parent :: Browsable a => a -> <ReadGraph> a Returns the parent of the given entity. Fails if there is no unique parent. possibleParent :: Browsable a => a -> <ReadGraph> Maybe a As parent but returns child :: Browsable a => a -> String -> <ReadGraph> a
possibleChild :: Browsable a => a -> String -> <ReadGraph> Maybe a As child but returns childWithPath :: Browsable a => a -> [String] -> <ReadGraph> a Returns a child Browsable of the specified parent that has that is the child of the specified parent with the specified name path. possibleChildWithPath :: Browsable a => a -> [String] -> <ReadGraph> Maybe a Like Objects(#) :: Resource -> Resource -> <ReadGraph> [Resource]
singleObject :: Resource -> Resource -> <ReadGraph> Resource Assumes that there is exactly one object with the given subject and predicate and returns it. possibleObject :: Resource -> Resource -> <ReadGraph> Maybe Resource If there is exactly one object with the given possibleObjectWithType :: Resource -> Resource -> Resource -> <ReadGraph> Maybe Resource
objectsWithType :: Resource -> Resource -> Resource -> <ReadGraph> [Resource]
assertedObjects :: Resource -> Resource -> <ReadGraph> [Resource] assertedObjects subject predicate` returns all asserted objects defined in the specified subjects with the given predicate. Statementsdata Statement A statement is an edge in a semantic graph. subjectOf :: Statement -> Resource Returns the subject of the statement, the resource the edge starts from. predicateOf :: Statement -> Resource Returns the predicate of the statement, the relation the edge stands for. objectOf :: Statement -> Resource Returns the object of the statement, the resource the edge points to. statements :: Resource -> Resource -> <ReadGraph> [Statement] statements subject predicate` returns all statements with the given subject and predicate. singleStatement :: Resource -> Resource -> <ReadGraph> Statement Assumes that there is exactly one statement with the given subject and predicate and returns it. assertedStatements :: Resource -> Resource -> <ReadGraph> [Statement] assertedStatements subject predicate` returns all asserted statements defined in the specified subjects with the given predicate. isAsserted :: Statement -> Resource -> <ReadGraph> Boolean
Special objectssingleTypeOf :: Resource -> Resource -> <ReadGraph> Resource
possibleTypeOf :: Resource -> Resource -> <ReadGraph> Maybe Resource As singleTypeOf but returns inverseOf :: Resource -> <ReadGraph> Resource Returns the inverse relation of the given relation. Fails if the relation has no inverse. possibleInverseOf :: Resource -> <ReadGraph> Maybe Resource As inverseOf but returns superTypesOf :: Resource -> <ReadGraph> Set.T Resource Returns all types the given type inherits from, transitively. The type itself is not included in the result. superRelationsOf :: Resource -> <ReadGraph> Set.T Resource Returns all relations the given relation is a subrelation of, transitively. The relation itself is not included in the result. LiteralspossibleRelatedValue :: Serializable a => Resource -> Resource -> <ReadGraph> Maybe a Reads the value of the literal that is an object with the given subject and
predicate, or untypedValueOf :: Resource -> <ReadGraph> Dynamic Reads the value stored in the given literal as a untypedRelatedValue :: Resource -> Resource -> <ReadGraph> a As relatedValue but the binding comes from the data type recorded in the database instead of from the expected type. The result is not checked against the type the caller expects. untypedPossibleRelatedValue :: Resource -> Resource -> <ReadGraph> Maybe a As untypedRelatedValue but returns PredicatesisInstanceOf :: Resource -> Resource -> <ReadGraph> Boolean
isSubrelationOf :: Resource -> Resource -> <ReadGraph> Boolean
isInheritedFrom :: Resource -> Resource -> <ReadGraph> Boolean
isParent :: Resource -> Resource -> <ReadGraph> Boolean
existsStatement :: Resource -> Resource -> <ReadGraph> Boolean
existsStatement3 :: Resource -> Resource -> Resource -> <ReadGraph> Boolean
predicatesOf :: Resource -> <ReadGraph> [Resource] Returns the predicates of all statements that have the given resource as subject, assertions included. possiblePredicateByName :: Resource -> String -> <ReadGraph> Maybe Resource
possiblePredicateByNameFromType :: Resource -> String -> <ReadGraph> Maybe Resource
isAsserted :: Statement -> Resource -> <ReadGraph> Boolean
Special resourcescurrentModel :: <ReadGraph> Resource Gives the current active model. currentProject :: () -> Resource Returns the project resource of the current session. Fails if there is no session or no current project. getRootLibrary :: () -> <ReadGraph> Resource Returns the root library of the database, the resource at the root of the URI hierarchy. listOntologies :: () -> <ReadGraph> [Resource] Returns the ontologies found under the root library. possibleCurrentModel :: <ReadGraph> Maybe Resource Gives the current active model if it exists or Nothing otherwise. Resource idresourceId :: Resource -> Long Returns the 64-bit unique identifier of the resource. resourceFromId :: Long -> <ReadGraph> Resource Returns the resource with the given 64-bit identifier, the inverse of resourceId. Fails if the identifier does not refer to a resource. Queriessubquery :: <ReadGraph,Proc> a -> <ReadGraph,Proc> a Makes a new read request with given procedure for calculating the result. The request is cached only if the current request is listened. subqueryA :: <ReadGraph,AsyncReadGraph,Proc> a -> <ReadGraph,Proc> a Performs synchronously a new AsyncRead request. subqueryC :: <ReadGraph,Proc> a -> <ReadGraph,Proc> a Makes a new read request with given procedure for calculating the result. The request is always cached. subqueryL :: <ReadGraph,Proc> a -> (a -> <ReadGraph,b> ()) -> (Throwable -> <ReadGraph,b> ()) -> <b> Boolean -> <ReadGraph,Proc,b> () Makes a new read asynchronous request with function to handle the request result. The last subqueryP :: <ReadGraph,Proc> a -> (a -> <ReadGraph,b> ()) -> (Throwable -> <ReadGraph,b> ()) -> <AsyncReadGraph,Proc> () Performs asynchronously a new Read request with given result and exception handlers. unaryQuery :: (a -> <ReadGraph,c> b) -> a -> <ReadGraph> b
unaryQueryCached :: (a -> <ReadGraph,c> b) -> a -> <ReadGraph> b As unaryQuery but the request is always cached. WritingAdding statementsnewResource :: () -> <WriteGraph> Resource Creates a new resource. claim :: Resource -> Resource -> Resource -> <WriteGraph> () Adds a statement to the semantic graph. claimWithInverse :: Resource -> Resource -> Maybe Resource -> Resource -> <WriteGraph> ()
deny :: Resource -> Resource -> Resource -> <WriteGraph> () Removes a statement with the given subject, predicate and object denyByPredicate :: Resource -> Resource -> <WriteGraph> ()
denyAllStatements :: Resource -> <WriteGraph> () Removes every statement that has the given resource as subject, together with the inverses of those statements. Needs a write transaction. claimAssertion :: Resource -> Resource -> Resource -> <WriteGraph> ()
Writing literalsclaimRelatedValue :: Serializable a => Resource -> Resource -> a -> <WriteGraph> () Sets the value of the literal that is an object with the given subject and predicate. claimRelatedValueWithType :: Serializable a => Resource -> Resource -> Resource -> a -> <WriteGraph> ()
untypedClaimRelatedValue :: Resource -> Resource -> a -> <WriteGraph> () As claimRelatedValue but the binding is chosen from the runtime class of the value instead of from the expected type. Needs a write transaction. denyValue :: Resource -> <WriteGraph> () Removes the literal value of the given resource, if it has one. Needs a write transaction. Ordered setsaddToOrderedSet :: Resource -> Resource -> <WriteGraph> Boolean
addFirstToOrderedSet :: Resource -> Resource -> <WriteGraph> Boolean
addAfterToOrderedSet :: Resource -> Resource -> Resource -> <WriteGraph> Boolean
addBeforeToOrderedSet :: Resource -> Resource -> Resource -> <WriteGraph> Boolean
removeFromOrderedSet :: Resource -> Resource -> <WriteGraph> Boolean
setOrderedSet :: Resource -> [Resource] -> <WriteGraph> Boolean
elementsOfOrderedSet :: Resource -> <ReadGraph> [Resource]
parentOrderedSet :: Resource -> <ReadGraph> Resource Returns the ordered set the given element belongs to. Fails if the element belongs to no ordered set or to more than one. Linked ListelementsOfList :: Resource -> <ReadGraph> [Resource]
createList :: [Resource] -> <WriteGraph> Resource
createListWithType :: Resource -> [Resource] -> <WriteGraph> Resource
insertListBack :: Resource -> [Resource] -> <WriteGraph> ()
insertListFront :: Resource -> [Resource] -> <WriteGraph> ()
removeListElement :: Resource -> Resource -> <WriteGraph> Boolean
swapListElementWithPrevious :: Resource -> Resource -> <WriteGraph> Boolean
swapListElementWithNext :: Resource -> Resource -> <WriteGraph> Boolean
TransactionssyncRead :: (() -> <Proc,ReadGraph> a) -> <Proc> a Executes a read transaction and waits that it completes. asyncRead :: (() -> <Proc,ReadGraph> a) -> <Proc> () Begins a read transaction and immediately returns. syncWrite :: (() -> <Proc,ReadGraph,WriteGraph> a) -> <Proc> a Executes a write transaction and waits that it completes. delayedSyncWrite :: (() -> <Proc,WriteGraph> a) -> <Proc> a Executes a delayed write transaction and waits that it completes. asyncWrite :: (() -> <Proc,ReadGraph,WriteGraph> a) -> <Proc> () Begins a write transaction and immediately returns. virtualSyncWriteMem :: String -> (() -> <b,WriteGraph> a) -> <b,WriteGraph> a
virtualSyncWriteWS :: String -> (() -> <b,WriteGraph> a) -> <b,WriteGraph> a As virtualSyncWriteMem but writes into the workspace-persistent virtual graph with the given identifier. Such a graph is stored on disk and restored when the workspace is opened again. lift1Read :: (a -> <ReadGraph,Proc> b) -> a -> <Proc> b Turns a one-argument function that needs a read transaction into one that can be called without a transaction, by executing it in a read transaction of its own and waiting that it completes. lift2Read :: (a -> b -> <ReadGraph,Proc> c) -> a -> b -> <Proc> c As lift1Read but for a function of two arguments. lift3Read :: (a -> b -> c -> <ReadGraph,Proc> d) -> a -> b -> c -> <Proc> d As lift1Read but for a function of three arguments. lift1Write :: (a -> <WriteGraph,Proc> b) -> a -> <Proc> b Turns a one-argument function that needs a write transaction into one that can be called without a transaction, by executing it in a write transaction of its own and waiting that it completes. lift2Write :: (a -> b -> <WriteGraph,Proc> c) -> a -> b -> <Proc> c As lift1Write but for a function of two arguments. lift3Write :: (a -> b -> c -> <WriteGraph,Proc> d) -> a -> b -> c -> <Proc> d As lift1Write but for a function of three arguments. addCommentMetadata :: String -> <WriteGraph> () Attaches a comment to the ongoing write transaction. The comment is stored in the metadata of the change set and is what the undo history shows for the operation. Needs a write transaction. makeSynchronous :: Boolean -> <ReadGraph> () Sets the GRAPH_HINT_SYNCHRONOUS hint of the current graph handle. Use withGraphHintBoolean to set the hint for the duration of one function only. enableDependencies :: () -> <WriteGraph> () Turns maintenance of the dependency index back on for the ongoing write transaction. Needs a write transaction. disableDependencies :: () -> <WriteGraph> () Stops maintaining the dependency index for the ongoing write transaction. The setting is reset when the transaction ends. Needs a write transaction. UndomarkUndoPoint :: () -> <WriteGraph> () Marks the beginning of the ongoing write transaction as an undo point. Needs a write transaction. Calling it more than once during the same transaction has no further effect. startUndoPoint also attaches a comment that the undo history can show. startUndoPoint :: String -> <WriteGraph> () Marks the beginning of the ongoing write transaction as an undo point and attaches the given comment to it, which is what the undo history shows for the operation. Needs a write transaction. undo :: () -> <Proc> String Undoes the last write operation and returns a description of what was reverted. If the undo history is empty, nothing is changed and the description says so. redo :: () -> <Proc> String Redoes the last undone write operation and returns a description of what was redone. If the redo history is empty, nothing is changed and the description says so. undoOperations :: Integer -> <Proc> String As undo but undoes the given number of operations. Generation of resource namesfindFreshName :: String -> Resource -> <ReadGraph> String
findFreshEscapedName :: String -> Resource -> <ReadGraph> String As findFreshName but separates the running number from the name with an underscore instead of a space. Helper functions for handling URIsescapeURI :: String -> String Escapes a string so that it can be used as one segment of a URI, replacing the
characters that are not allowed there, the path separator included, with unescapeURI :: String -> String Turns the splitURI :: String -> [String] Splits an absolute URI at its last path separator and returns the namespace and the local name as a two element list. Fails if the URI has no path separator. Structured graph writingnewEntity :: [Resource -> <ReadGraph,WriteGraph> ()] -> <ReadGraph,WriteGraph> Resource Creates a new resource, applies each of the given specifications to it and
returns it. The specifications are functions such as hasStatement :: Resource -> Resource -> Resource -> <WriteGraph> () hasName :: String -> Resource -> <WriteGraph> () hasType :: Resource -> Resource -> <WriteGraph> () hasLabel :: String -> Resource -> <WriteGraph> () hasProperty :: Serializable a => Resource -> a -> Resource -> <WriteGraph> () hasTypedProperty :: Serializable a => Resource -> a -> Resource -> Resource -> <WriteGraph> () hasPossibleProperty :: Serializable a => Resource -> Maybe a -> Resource -> <WriteGraph> () hasParent :: Resource -> Resource -> <WriteGraph> () ClustersnewClusterSet :: Resource -> <WriteGraph> () Creates a new cluster set identified by the given resource. Clusters are the units in which the database stores resources. Fails if a cluster set with that identifier already exists. Needs a write transaction. selectClusterSet :: Resource -> <WriteGraph> () Chooses the cluster set that resources created later in this transaction go into, based on the cluster set of the given resource. Falls back to the cluster set of the root library if the resource does not determine one. Needs a write transaction. sortByCluster :: [a] -> (a -> Resource) -> <ReadGraph> [a]
DebuggingqueryDebugSupport :: String -> <Proc> String Runs the given command through the database debug support and returns its
output. The command is passed on as queryListSupport :: String -> <Proc> String As queryDebugSupport but the command is passed on as Domain/Namespace Migrationdata MigrationConfig
If
Defines whether the migration should collect data for performed and failed migrations in the collections included in this class. If the client only wants to know whether migration succeeded or failed somehow, this can be set to false by the constructor.
If MigrationConfig :: Boolean -> Boolean -> Boolean -> MigrationConfig data MigrationReport The result of a domain migration: what was processed, what was migrated and what failed. Read it as text with dumpMigrationReport or dumpMigrationReport2, and apply the changes a dry run collected with applyMigrationChanges. How much detail the report holds is decided by the MigrationConfig the migration was run with. migrateDomainWithSpecs :: MigrationConfig -> Resource -> [(Resource, [Resource])] -> <WriteGraph> MigrationReport
Executes graph domain based migration for the specified The function produces a Migration specifications are provided as a list of
Multiple specifications can be provided to the function. The migration will process all database statements of the computed graph domain
for If a match is found in a target namespace, the statement containing the migrated resources will first be denied and then reclaimed using the migrated predicate and/or object. If no match can be found in any of the provided target namespaces, migration for that specific resource is considered failed and will be included in the produced MigrationReport according to what is specified in the provided MigrationConfig. migrateDomain :: MigrationConfig -> Resource -> Resource -> Resource -> <WriteGraph> MigrationReport
Equal to applyMigrationChanges :: MigrationReport -> <WriteGraph> () If dumpMigrationReport :: MigrationReport -> <ReadGraph> String Formats a migration report as text: a summary followed by one section for each kind of change, listing the subjects whose statements, predicates or objects were changed and the ones whose migration failed. dumpMigrationReport2 :: MigrationReport -> <ReadGraph> String Formats a migration report as text like
dumpMigrationReport but lists the changes grouped by
subject, marking the changed predicates and objects with an asterisk. The
detailed part is present only if the migration was run with
Miscellaneous functionsGRAPH_HINT_SYNCHRONOUS :: String The key of the graph hint that controls synchronous reading. While the hint is
activateOnce :: Resource -> <Proc> () Runs the triggers attached to the given resource once and then deactivates them. addMetadataListener :: ChangeListener -> <Proc> () Registers a listener that is called after every completed write transaction of the current session. assertedObjects_ :: Resource -> Resource -> <ReadGraph> Collection Resource Returns all asserted objects with the given subject and predicate as a Java
collection. assertedStatements_ :: Resource -> Resource -> <ReadGraph> Collection Statement Returns all asserted statements with the given subject and predicate as a Java
collection. claimRelatedValueWithType_ :: Resource -> Resource -> Resource -> a -> Binding a -> <WriteGraph> ()
claimRelatedValue_ :: Resource -> Resource -> a -> Binding a -> <WriteGraph> ()
collectionToList :: Collection a -> [a] Copies the elements of a Java collection into a list. copyTo :: Resource -> Resource -> <WriteGraph> Resource
denyRelatedValue :: Resource -> Resource -> <WriteGraph> ()
emptyTrashBin :: () -> <Proc> () Deletes the contents of the trash bin of the current project and then purges the database. The deletion cannot be undone. flushCluster :: () -> <WriteGraph> () Ends writing into the current cluster and starts a new one, so that resources created after this call go into the new cluster. Needs a write transaction. getDataType :: Resource -> <ReadGraph> Datatype Returns the data type of the value stored in the given literal. Fails if the resource has no data type. isImmutable :: Resource -> <ReadGraph> Boolean Returns True if the given resource is immutable. Immutability is a property of the cluster the resource belongs to. isPersistent :: Resource -> Boolean Returns True if the resource is stored in the persistent database and False if it exists only in a virtual graph. objects_ :: Resource -> Resource -> <ReadGraph> Collection Resource Returns all objects with the given subject and predicate as a Java collection.
possibleFromDynamic :: Typeable a => String -> Dynamic -> Maybe a Tries to convert the given Dynamic value to a value with the inferred type possibleRelatedInteger :: Resource -> Resource -> <ReadGraph> Maybe Integer Reads the value of the literal that is an object with the given subject and
predicate as an integer, or possibleRelatedString :: Resource -> Resource -> <ReadGraph> Maybe String Reads the value of the literal that is an object with the given subject and
predicate as a string, or possibleRelatedValue2 :: Resource -> Resource -> <ReadGraph> Maybe a As relatedValue2 but returns possibleRelatedValue_ :: Resource -> Resource -> Binding a -> <ReadGraph> Maybe a As relatedValue_ but returns possibleResourceChild :: Resource -> String -> <ReadGraph> Maybe Resource
possibleStatement :: Resource -> Resource -> <ReadGraph> Maybe Statement If there is exactly one statement with the given prettyPrintResource :: Resource -> Boolean -> <ReadGraph> String
printChanges :: Long -> Long -> <ReadGraph> String Simple change / metadata debugging report. purgeDatabase :: () -> <Proc> () Asks the server to purge the database. If the system property
removeMetadataListener :: ChangeListener -> <Proc> () Removes a listener registered with addMetadataListener. resourceChildrenOf :: Resource -> <ReadGraph> [Resource] Returns the resources the given resource consists of. resourceToCollection :: a -> Collection a Reinterprets a value as a Java collection without converting or checking anything. The result is usable only if the value already is a Java collection. safeExec :: (() -> <Proc> a) -> <Proc> a Executes the given function and returns its result. If the function throws,
the exception is logged and setDependenciesIndexingDisabled :: Boolean -> <WriteGraph> () Turns maintenance of the dependency index off or on for the ongoing write transaction. The setting is reset when the transaction ends. Needs a write transaction. statements_ :: Resource -> Resource -> <ReadGraph> Collection Statement Returns all statements with the given subject and predicate as a Java
collection. syncActivateOnce :: Resource -> <WriteGraph,Proc> () As activateOnce but runs the triggers inside the ongoing write transaction. Needs a write transaction. untypedClaimValue :: Resource -> a -> <WriteGraph> () Stores the given value into the given resource as its literal value, replacing any previous value. Needs a write transaction. untypedPossibleValueOf :: Resource -> <ReadGraph> Maybe Dynamic As untypedValueOf but returns updateEntity :: Resource -> [Resource -> <ReadGraph,WriteGraph> ()] -> <ReadGraph,WriteGraph> Resource Applies each of the given specifications to an existing resource and returns the resource. See newEntity. Needs a write transaction. withGraphHintBoolean :: String -> Boolean -> (() -> <b,ReadGraph> a) -> <ReadGraph> a
|