Class: CurrentGraph

olympe.dc. CurrentGraph

Helper to query the current state of the dbView directly.


new CurrentGraph()

Methods


<static> exists(tag)

Determines if the instance exists in the local DB.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

Deprecated:
Returns:
Type
boolean

<static> findAllRelated(startTag, relations, predicate)

Find all the instances matching the provided predicate when following all the given relations.

Parameters:
Name Type Description
startTag olympe.dc.InstanceTag

Tag of the starting instance

relations Array.<olympe.dc.registry.Relation>

The relations to follow

predicate function

Anonymous predicate function

Deprecated:
Returns:
Type
Array.<string>

<static> findRecursive(startTag, relationTag, relationDirection, predicate)

Find the first instance matching the provided predicate when following the given relation recursively. Return null if not found.

Parameters:
Name Type Description
startTag olympe.dc.InstanceTag

Tag of the starting instance

relationTag string

Tag of the followed relation

relationDirection olympe.dc.RelationDirection

Direction in which to follow the recursive relation.

predicate function

Anonymous predicate function

Deprecated:
Returns:
Type
string

<static> findRelated(startTag, relations, predicate)

Find the first instance matching the provided predicate when following all the given relations.

Parameters:
Name Type Description
startTag olympe.dc.InstanceTag

Tag of the starting instance

relations Array.<olympe.dc.registry.Relation>

The relations to follow

predicate function

Anonymous predicate function

Deprecated:
Returns:
Type
string

<static> getExtendedModel(instance)

Returns the tag of the parent model of the instance given as parameter, if the instance exists and it it has a model. Returns null instead.

Parameters:
Name Type Description
instance olympe.dc.InstanceTag

The instance, represented by any of the option offered by InstanceTag

Deprecated:
Returns:
Type
string

<static> getExtendedModels(modelTag [, endTag])

Get all the models extended by this model (including self). Optionally define an end tag to get a subset of extended models. Will throw an error if the expected end model is not found.

Parameters:
Name Type Argument Default Description
modelTag olympe.dc.InstanceTag

Tag of the starting model instance

endTag olympe.dc.InstanceTag <optional>
olympe.dc.Sync.entry

Optional end instance tag after which to stop following the extend relations.

Deprecated:
Returns:
Type
Array.<string>

<static> getInstanceName(tag)

Get the current name of an instance, or null if the instance is unnamed.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

Deprecated:
Returns:
Type
string

<static> getInstances(modelTag)

Get the current instances of a model.

Parameters:
Name Type Description
modelTag olympe.dc.InstanceTag

Tag of the model instance

Deprecated:
Returns:
Type
Array.<string>

<static> getModel(tag)

Return the model of an instance, or null if the instance is not known.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

Deprecated:
Returns:
Type
string

<static> getMultiRelated(startTag, relations)

Gets the currently related instances following all the specified relations.

Parameters:
Name Type Description
startTag olympe.dc.InstanceTag

the instance to start with

relations Array.<olympe.dc.registry.Relation>

Relations to follow

Deprecated:
Returns:

The resulting array

Type
Array.<string>

<static> getProperty(tag, property)

Get the value of an instance's property, or null if the property is not set.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

property olympe.dc.registry.Property

Property to retrieve

Deprecated:
Returns:

the current value or null

Type
*

<static> getRecursiveRelated(startTag, relationTag, relationDirection [, endTag])

Get all the instance following the given relation recursively.

Parameters:
Name Type Argument Description
startTag olympe.dc.InstanceTag

Tag of the starting instance

relationTag string

Tag of the followed relation

relationDirection olympe.dc.RelationDirection

Direction in which to follow the recursive relation.

endTag olympe.dc.InstanceTag <optional>

Optional end instance tag after which to stop following the relation. If provided, only a single instance should be present at each successive depth.

Deprecated:
Returns:
Type
Array.<string>

<static> getRelated(tag, relation)

Gets the currently related instances.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

relation olympe.dc.registry.Relation

Relation to follow

Deprecated:
Returns:

The resulting array of tags.

Type
Array.<string>

<static> getUniqueRelated(tag, relation)

Gets the currently unique related instance.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

relation olympe.dc.registry.Relation

Relation to follow

Deprecated:
Returns:

The tag or null if there is no match.

Type
string

<static> isAssignableTo(value, property)

Checks whether a particular value is assignable to a specific property.

Parameters:
Name Type Description
value *

The value to test.

property olympe.dc.InstanceTag

The tag of the property.

Returns:

true if its assignable.

Type
boolean

<static> isExtending(modelTag, extendedTag)

Assess whether the model modelTag is extending the model extendedTag

Parameters:
Name Type Description
modelTag olympe.dc.InstanceTag

Tag of the starting model instance

extendedTag olympe.dc.InstanceTag

Tag of the extended model instance

Deprecated:
Returns:
Type
boolean

<static> isInstanceof(instanceTag, modelTag)

Assess whether the instance instanceTag is instanceof the model modelTag. Note: if A is instance of B, and B extends C, A is an instance of both B and C.

Parameters:
Name Type Description
instanceTag olympe.dc.InstanceTag

Tag of the starting model instance

modelTag olympe.dc.InstanceTag

Tag of the extended model instance

Deprecated:
Returns:
Type
boolean

<static> isModel(tag)

Determines if the instance is a model.

Parameters:
Name Type Description
tag olympe.dc.InstanceTag

Instance

Deprecated:
Returns:
Type
boolean