Class: GraphDB

olympe.dc. GraphDB

GraphDB interface: in-memory specialized graph database. This is where all instances of Data Cloud object (aka Syncs) are referenced. It provides an API to navigate the graph based on relationships (e.g. 'model', 'property', etc.) It also provides mechanisms, via callbacks, for notification of changes in the graph.


new GraphDB(driver)

Parameters:
Name Type Description
driver olympe.dc.DBView
Deprecated:

Methods


getCurrentDefaultProperties(tag [, ownOnly])

Gets all current instance default properties values.

Parameters:
Name Type Argument Default Description
tag string

Instance tag

ownOnly boolean <optional>
false

If true, returns only own properties (ie. not inherited)

Deprecated:
Returns:

A map of all the default properties values indexed by properties names

Type
Object

getCurrentDefaultProperty(tag, name [, ownOnly])

Get an instance default property current value.

Parameters:
Name Type Argument Default Description
tag string

Instance tag

name string

Property name

ownOnly boolean <optional>
false

If true, returns only own property (ie. not inherited)

Deprecated:
Returns:
Type
* | undefined

getCurrentExtend(tag)

Gets the current instance parent model, that is the parent at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

Deprecated:
Returns:

Current parent model tag if any, undefined otherwise

Type
string | undefined

getCurrentIncomingRelated(tag)

Gets currently incoming relations, that is left-related relations types at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

Deprecated:
Returns:

An array of incoming relation tags

Type
Array.<string>

getCurrentModel(tag)

Gets the current instance model, that is the model at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

Deprecated:
Returns:

Current model tag for the specified instance if any, undefined otherwise

Type
string | undefined

getCurrentOutgoingRelated(tag)

Gets currently outgoing relations, that is right-related relations types at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

Deprecated:
Returns:

An array of incoming relation tags

Type
Array.<string>

getCurrentProperties(tag [, ownOnly])

Gets all current instance properties values, that is values at the time of the method call

Parameters:
Name Type Argument Default Description
tag string

Instance tag

ownOnly boolean <optional>
false

If true, returns only own properties (ie. not inherited and defaults)

Deprecated:
Returns:

A map of all properties values indexed by properties names

Type
Object

getCurrentProperty(tag, name)

Gets an instance property current value, that is the value at the moment of the method call

Parameters:
Name Type Description
tag string

Instance tag

name string

Property name

Deprecated:
Returns:

Current property value or undefined if not found

Type
* | undefined

getCurrentRelated(tag, type, direction)

Gets currently related instances, that is related instances at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

type string

Relation type tag

direction olympe.dc.RelationDirection

Relation direction

Deprecated:
Returns:

A map of related instances tags to related instances tag

Type
Object.<string>

getCurrentRelatedCount(tag, type, direction)

Gets the amount of related instances at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

type string

Relation type tag

direction olympe.dc.RelationDirection

Relation direction

Returns:
Type
number

getCurrentSource(tag)

Gets the current instance source, that is the source master of the instance at the time of the method call

Parameters:
Name Type Description
tag string

Instance tag

Deprecated:
Returns:

Current source id for the specified instance

Type
string | undefined

getCurrentVersion(tag)

Gets the current instance version, that is the version at the moment of the method call

Parameters:
Name Type Description
tag string

Instance tag

Deprecated:
Returns:

Current instance version

Type
number | undefined

getUniqueCurrentRelated(tag, type, direction)

Gets the unique instance that is related at the time of the method call. This function differs from getCurrentRelated in the following way:

  • it returns a tag directly, and not a map of tags
  • it returns undefined if no related instance is found
  • it throws an error if more than one relation is found
Parameters:
Name Type Description
tag string

Instance tag

type string

Relation type tag

direction olympe.dc.RelationDirection

Relation direction

Deprecated:
Returns:

The related instance tag

Type
string | undefined

instanceCurrentlyExists(tag)

Checks whether an existing instance exists in the DB under the given tag at the time the call is made

Parameters:
Name Type Description
tag string
Deprecated:
Returns:
Type
boolean

offAnyProperty(tag, id)

Unregisters an anyProperty callback from the specified instance

Parameters:
Name Type Description
tag string
id string
Deprecated:

offAnyRelation(tag, id [, noEvent])

Unregisters a callback on all relations of an instance. For each existing relation at the time of hte method call and unless otherwise specified, a REMOVED event will be immediately fired upon unregistration.

Parameters:
Name Type Argument Default Description
tag string

Instance tag

id string

Callback identifier

noEvent boolean <optional>
false

If true, no REMOVED event will be fired upon unregistration

Deprecated:

offInstance(tag, id [, noEvent])

Unregisters a callback on an instance. Unless otherwise specified, calling this method will immediately trigger a REMOVED event.

Parameters:
Name Type Argument Default Description
tag string

Instance tag

id string

Callback identifier

noEvent boolean <optional>
false

If true, no REMOVED event will be fired upon unregistration

Deprecated:

offProperty(tag, name, id)

Unregisters a property update callback from an instance.

Parameters:
Name Type Description
tag string

Instance tag.

name string

Property name.

id string

Callback identifier.

Deprecated:

offRelation(tag, type, direction, id [, noEvent])

Unregisters a callback on an instance relation. For each existing relation at the time of the method call and unless otherwise specified, a REMOVED event will be immediately fired upon unregistration.

Parameters:
Name Type Argument Default Description
tag string

Instance tag

type string

Relation type tag

direction olympe.dc.RelationDirection

Relation direction

id string

Callback identifier

noEvent boolean <optional>
false

If true, no REMOVED event will be fired upon unregistration

Deprecated:

onAnyProperty(tag, callback [, id])

Registers a callback to be invoked any time a property of the specified instance gets a value.

Parameters:
Name Type Argument Description
tag string
callback olympe.dc.DBView.AnyPropertyCallback
id string <optional>
Deprecated:
Returns:
Type
string

onAnyRelation(tag, callback [, id])

Register a callback on an instance which is called every time the instance get a new relation. For each existing relation at the time of the method call, an ADDED event will be immediately fired. If two callbacks are registered with the same identifier, the last registered one will simply overwrite the first one.

Parameters:
Name Type Argument Description
tag string

Instance tag

callback olympe.dc.DBView.RelationCallback

Function to run when any relation is created or removed on the specified instance

id string <optional>

Callback identifier

Deprecated:
Returns:

Registered callback identifier

Type
string

onInstance(tag, callback [, id])

Register a callback on an instance. If the instance already exists at the time of the method call, an ADDED event will be immediately fired

Parameters:
Name Type Argument Description
tag string

Instance tag

callback olympe.dc.DBView.InstanceCallback

Callback function

id string <optional>

Callback identifier

Deprecated:
Returns:

Registered callback identifier

Type
string

onProperty(tag, name, callback [, id])

Registers a callback to be invoked when the specified property of the specified instance is updated.

Parameters:
Name Type Argument Description
tag string

Instance tag.

name string

Property name.

callback olympe.dc.DBView.PropertyCallback

Callback function.

id string <optional>

Callback identifier.

Deprecated:
Returns:

Registered callback identifier.

Type
string

onRelation(tag, type, direction, callback [, id])

Register a callback on an instance relation. For each existing relation at the time of the method call, an ADDED event will be immediately fired. Also, if two callbacks are registered with the same identifier, the last registered one will simply overwrite the first one.

Parameters:
Name Type Argument Description
tag string

Instance tag

type string

Relation type tag

direction olympe.dc.RelationDirection

Relation direction

callback olympe.dc.DBView.InstanceCallback

Callback function

id string <optional>

Callback identifier

Deprecated:
Returns:

Registered callback identifier

Type
string