new CurrentGraph()
Methods
-
<static> findRecursive(graphDB, 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 graphDB
olympe.dc.GraphDB 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
Returns:
- Type
- string
-
<static> findRelated(graphDB, startTag, relations, predicate)
-
Find the first instance matching the provided predicate when following all the given relations.
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB startTag
olympe.dc.InstanceTag Tag of the starting instance
relations
Array.<olympe.dc.registry.Relation> The relations to follow
predicate
function Anonymous predicate function
Returns:
- Type
- string
-
<static> getExtendedModels(graphDB, 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 graphDB
olympe.dc.GraphDB 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.
Returns:
- Type
- Array.<string>
-
<static> getInstanceName(graphDB, tag)
-
Get the current name of an instance, or null if the instance is unnamed.
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB tag
olympe.dc.InstanceTag Instance
Returns:
- Type
- string
-
<static> getInstances(graphDB, modelTag)
-
Get the current instances of a model.
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB modelTag
olympe.dc.InstanceTag Tag of the model instance
Returns:
- Type
- Array.<string>
-
<static> getParentModel(graphDB, 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 graphDB
olympe.dc.GraphDB instance
olympe.dc.InstanceTag The instance, represented by any of the option offered by InstanceTag
Returns:
- Type
- string
-
<static> getRecursiveInstances(graphDB, startTag, relationTag, relationDirection [, endTag])
-
Get all the instance following the given relation recursively.
Parameters:
Name Type Argument Description graphDB
olympe.dc.GraphDB 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.
Returns:
- Type
- Array.<string>
-
<static> getRelated(graphDB, tag, relation)
-
Gets the currently related instances.
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB tag
olympe.dc.InstanceTag Instance
relation
olympe.dc.registry.Relation Relation to follow
Returns:
The resulting array of tags.
- Type
- Array.<string>
-
<static> getUniqueRelated(graphDB, tag, relation)
-
Gets the currently unique related instance.
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB tag
olympe.dc.InstanceTag Instance
relation
olympe.dc.registry.Relation Relation to follow
Returns:
The tag or
null
if there is no match.- Type
- string
-
<static> isExtending(graphDB, modelTag, extendedTag)
-
Assess whether the model
modelTag
is extending the modelextendedTag
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB modelTag
olympe.dc.InstanceTag Tag of the starting model instance
extendedTag
olympe.dc.InstanceTag Tag of the extended model instance
Returns:
- Type
- boolean
-
<static> isInstanceof(graphDB, instanceTag, modelTag)
-
Assess whether the instance
instanceTag
is instanceof the modelmodelTag
. Note: if A is instance of B, and B extends C, A is an instance of both B and C.Parameters:
Name Type Description graphDB
olympe.dc.GraphDB instanceTag
olympe.dc.InstanceTag Tag of the starting model instance
modelTag
olympe.dc.InstanceTag Tag of the extended model instance
Returns:
- Type
- boolean
-
<static> isModel(graphDB, tag)
-
Determines if the instance is a model.
Parameters:
Name Type Description graphDB
olympe.dc.GraphDB tag
olympe.dc.InstanceTag Instance
Returns:
- Type
- boolean