DB module documentation

data Resource

A resource is a node in a semantic graph.

Reading

URIs

resource :: String -> <ReadGraph> Resource

Converts an absolute URI to a resource

possibleResource :: String -> <ReadGraph> Maybe Resource

Converts an absolute URI to a resource or returns Nothing if there is no such resource.

relativeResource :: Resource -> String -> <ReadGraph> Resource

Converts a relative URI to a resource starting from the given resource

Graph hierarchy

class Browsable a
fromUri :: Browsable a => String -> <ReadGraph> a
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
valueOf :: Browsable a => Serializable b => a -> <ReadGraph> b
genericRelatedValue :: Browsable a => a -> Resource -> <ReadGraph> b
genericPossibleRelatedValue :: Browsable a => a -> Resource -> <ReadGraph> Maybe b
variantValueOf :: Browsable a => a -> <ReadGraph> Variant
children :: Browsable a => a -> <ReadGraph> [a]
parent :: Browsable a => a -> <ReadGraph> a
possibleParent :: Browsable a => a -> <ReadGraph> Maybe a
child :: Browsable a => a -> String -> <ReadGraph> a
possibleChild :: Browsable a => a -> String -> <ReadGraph> Maybe a

Objects

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

subject # predicate returns all objects with the given subject and predicate.

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 subject and predicate, possibleObject subject predicate returns it. Otherwise, it returns Nothing.

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

Statements

data Statement

A statement is an edge in a semantic graph.

subjectOf :: Statement -> Resource
predicateOf :: Statement -> Resource
objectOf :: Statement -> Resource
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.

Special objects

singleTypeOf :: Resource -> Resource -> <ReadGraph> Resource
possibleTypeOf :: Resource -> Resource -> <ReadGraph> Maybe Resource
inverseOf :: Resource -> <ReadGraph> Resource

Literals

relatedValue :: Serializable a => Resource -> Resource -> <ReadGraph> a

Reads the value of a literal that is an object with the given subject and predicate

possibleRelatedValue :: Serializable a => Resource -> Resource -> <ReadGraph> Maybe a
relatedValue2 :: Resource -> Resource -> <ReadGraph> a
untypedValueOf :: Resource -> <ReadGraph> Dynamic
untypedRelatedValue :: Resource -> Resource -> <ReadGraph> a
untypedPossibleRelatedValue :: Resource -> Resource -> <ReadGraph> Maybe a

Predicates

isInstanceOf :: Resource -> Resource -> <ReadGraph> Boolean

isInstanceOf r t returns true, if r is an instance of t

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

Special resources

currentModel :: <ReadGraph> Resource

Gives the current active model.

currentProject :: () -> Resource
getRootLibrary :: () -> <ReadGraph> Resource
listOntologies :: () -> <ReadGraph> [Resource]

Resource id

resourceId :: Resource -> Long

Returns the 64-bit unique identifier of the resource.

resourceFromId :: Long -> <ReadGraph> Resource

Writing

Adding statements

newResource :: () -> <WriteGraph> Resource

Creates a new resource.

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

Adds a statement to the semantic graph.

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

Removes a statement with the given subject, predicate and object

denyByPredicate :: Resource -> Resource -> <WriteGraph> ()
denyAllStatements :: Resource -> <WriteGraph> ()
claimAssertion :: Resource -> Resource -> Resource -> <WriteGraph> ()

Writing literals

claimRelatedValue :: 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> ()
denyValue :: Resource -> <WriteGraph> ()

Ordered sets

addToOrderedSet :: Resource -> Resource -> <WriteGraph> Boolean

addToOrderedSet s e adds element e to ordered set s

addFirstToOrderedSet :: Resource -> Resource -> <WriteGraph> Boolean

addFirstToOrderedSet s e adds element e to ordered set s as the first element

addAfterToOrderedSet :: Resource -> Resource -> Resource -> <WriteGraph> Boolean

addAfterToOrderedSet s p e adds element e to ordered set s after element p

addBeforeToOrderedSet :: Resource -> Resource -> Resource -> <WriteGraph> Boolean

addBeforeToOrderedSet s p e adds element e to ordered set s before element p

removeFromOrderedSet :: Resource -> Resource -> <WriteGraph> Boolean

removeFromOrderedSet s e removes element e from ordered set s

setOrderedSet :: Resource -> [Resource] -> <WriteGraph> Boolean
elementsOfOrderedSet :: Resource -> <ReadGraph> [Resource]
parentOrderedSet :: Resource -> <ReadGraph> Resource

Linked List

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

elementsOfList l returns elements of list l

createList :: [Resource] -> <WriteGraph> Resource

createList [e] creates a new list containing elements [e]

createListWithType :: Resource -> [Resource] -> <WriteGraph> Resource

createListWithType t [e] creates a new list with type t containing elements [e]

insertListBack :: Resource -> [Resource] -> <WriteGraph> ()

insertListBack l [e] inserts elements [e] back to the list l

insertListFront :: Resource -> [Resource] -> <WriteGraph> ()

insertListFront l [e] inserts elements [e] front of the list l

removeListElement :: Resource -> Resource -> <WriteGraph> Boolean

removeListElement l e removes a element e from the list l

swapListElementWithPrevious :: Resource -> Resource -> <WriteGraph> Boolean
swapListElementWithNext :: Resource -> Resource -> <WriteGraph> Boolean

Transactions

syncRead :: (() -> <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.

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
lift1Read :: (a -> <ReadGraph,Proc> b) -> a -> <Proc> b
lift2Read :: (a -> b -> <ReadGraph,Proc> c) -> a -> b -> <Proc> c
lift3Read :: (a -> b -> c -> <ReadGraph,Proc> d) -> a -> b -> c -> <Proc> d
lift1Write :: (a -> <WriteGraph,Proc> b) -> a -> <Proc> b
lift2Write :: (a -> b -> <WriteGraph,Proc> c) -> a -> b -> <Proc> c
lift3Write :: (a -> b -> c -> <WriteGraph,Proc> d) -> a -> b -> c -> <Proc> d
addCommentMetadata :: String -> <WriteGraph> ()
makeSynchronous :: Boolean -> <ReadGraph> ()
enableDependencies :: () -> <WriteGraph> ()
disableDependencies :: () -> <WriteGraph> ()

Undo

markUndoPoint :: () -> <WriteGraph> ()
startUndoPoint :: String -> <WriteGraph> ()
undo :: () -> <Proc> String
redo :: () -> <Proc> String
undoOperations :: Integer -> <Proc> String

Generation of resource names

findFreshName :: String -> Resource -> <ReadGraph> String
findFreshEscapedName :: String -> Resource -> <ReadGraph> String

Helper functions for handling URIs

escapeURI :: String -> String
unescapeURI :: String -> String
splitURI :: String -> [String]

Structured graph writing

newEntity :: [Resource -> <ReadGraph,WriteGraph> ()] -> <ReadGraph,WriteGraph> Resource
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> ()

Clusters

newClusterSet :: Resource -> <WriteGraph> ()
selectClusterSet :: Resource -> <WriteGraph> ()
sortByCluster :: [a] -> (a -> Resource) -> <ReadGraph> [a]

Debugging

queryDebugSupport :: String -> <Proc> String
queryListSupport :: String -> <Proc> String

Miscellaneous functions

GRAPH_HINT_SYNCHRONOUS :: String
activateOnce :: Resource -> <Proc> ()
addMetadataListener :: ChangeListener -> <Proc> ()
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.

claimRelatedValueWithType_ :: Resource -> Resource -> Resource -> a -> Binding a -> <WriteGraph> ()
claimRelatedValue_ :: Resource -> Resource -> a -> Binding a -> <WriteGraph> ()
claimWithInverse :: Resource -> Resource -> Maybe Resource -> Resource -> <WriteGraph> ()
collectionToList :: Collection a -> [a]
copyTo :: Resource -> Resource -> <WriteGraph> Resource
delayedSyncWrite :: (() -> <Proc,WriteGraph> a) -> <Proc> a

Executes a delayed write transaction and waits that it completes.

emptyTrashBin :: () -> <Proc> ()
getDataType :: Resource -> <ReadGraph> Datatype
isAsserted :: Statement -> Resource -> <ReadGraph> Boolean
isImmutable :: Resource -> <ReadGraph> Boolean
isPersistent :: Resource -> Boolean
objects_ :: Resource -> Resource -> <ReadGraph> Collection Resource
possibleChildWithPath :: Browsable a => a -> [String] -> <ReadGraph> Maybe a

Like childWithPath but returns Maybe a which will be Nothing if no child was found.

possibleCurrentModel :: <ReadGraph> Maybe Resource

Gives the current active model if it exists or Nothing otherwise.

possibleFromDynamic :: Typeable a => String -> Dynamic -> Maybe a

Tries to convert the given Dynamic value to a value with the inferred type

possibleInverseOf :: Resource -> <ReadGraph> Maybe Resource
possibleObjectWithType :: Resource -> Resource -> Resource -> <ReadGraph> Maybe Resource
possiblePredicateByName :: Resource -> String -> <ReadGraph> Maybe Resource
possiblePredicateByNameFromType :: Resource -> String -> <ReadGraph> Maybe Resource
possibleRelatedInteger :: Resource -> Resource -> <ReadGraph> Maybe Integer
possibleRelatedString :: Resource -> Resource -> <ReadGraph> Maybe String
possibleRelatedValue2 :: Resource -> Resource -> <ReadGraph> Maybe a
possibleRelatedValue_ :: Resource -> Resource -> Binding a -> <ReadGraph> Maybe a
possibleResourceChild :: Resource -> String -> <ReadGraph> Maybe Resource
possibleStatement :: Resource -> Resource -> <ReadGraph> Maybe Statement
predicatesOf :: Resource -> <ReadGraph> [Resource]
prettyPrintResource :: Resource -> Boolean -> <ReadGraph> String
purgeDatabase :: () -> <Proc> ()
relatedValue_ :: Resource -> Resource -> Binding a -> <ReadGraph> a
relatedVariantValue :: Resource -> Resource -> <ReadGraph> Variant
relatedVariantValue2 :: Resource -> Resource -> <ReadGraph> Variant
removeMetadataListener :: ChangeListener -> <Proc> ()
resourceChildrenOf :: Resource -> <ReadGraph> [Resource]
resourceToCollection :: a -> Collection a
safeExec :: (() -> <Proc> a) -> <Proc> a
statements_ :: Resource -> Resource -> <ReadGraph> Collection Statement
subquery :: <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.

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 isDisposed function parameter is used to determine if the listener is still alive or not.

superTypesOf :: Resource -> <ReadGraph> Set.T Resource
syncActivateOnce :: Resource -> <WriteGraph,Proc> ()
unaryQuery :: (a -> <ReadGraph,c> b) -> a -> <ReadGraph> b
unaryQueryCached :: (a -> <ReadGraph,c> b) -> a -> <ReadGraph> b
untypedClaimValue :: Resource -> a -> <WriteGraph> ()
untypedPossibleValueOf :: Resource -> <ReadGraph> Maybe Dynamic
updateEntity :: Resource -> [Resource -> <ReadGraph,WriteGraph> ()] -> <ReadGraph,WriteGraph> Resource
withGraphHintBoolean :: String -> Boolean -> (() -> <b,ReadGraph> a) -> <ReadGraph> a