new SubGraph( [id])
Creates an instance of a SubGraph.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
id |
string |
<optional> |
- Implements:
- Deprecated:
-
- SubGraph is replaced by olympe.dc.db.GraphPatch and olympe.dc.db.InstancePatch classes.
Classes
Methods
-
applyOperationsTo(writable)
-
Updates the specified object (writable) with the operation accumulated in this patch.
Parameters:
Name Type Description writable
olympe.dc.Writable the writable on which apply the operations contained in this patch.
- Implements:
Returns:
By convention, the writable given as parameter is returned to ease chaining.
- Type
- olympe.dc.Writable
-
createInstance(tag [, properties] [, id])
-
Creates an instance and returns it's tag
Parameters:
Name Type Argument Description tag
string New instance tag
properties
Map.<string, ?*> <optional>
Instance's properties (map of properties names to values)
id
number <optional>
operationId
- Implements:
-
createRelation(relationTag, originTag, destinationTag [, id])
-
Creates a relation between two instances.
Parameters:
Name Type Argument Description relationTag
string Tag of the relation
originTag
string Origin instance tag
destinationTag
string Destination instance tag
id
number <optional>
operationId
- Implements:
-
deleteInstance(tag [, followRule] [, id])
-
Deletes the specified instance. If specified, apply the follow rules to make a clean delete.
Parameters:
Name Type Argument Description tag
string followRule
olympe.dc.FollowRules <optional>
id
number <optional>
operationId
- Implements:
-
deleteRelation(relationTag, originTag, destinationTag [, id])
-
Removes a relation between two instances
Parameters:
Name Type Argument Description relationTag
string Tag of the relation
originTag
string Origin instance tag
destinationTag
string Destination instance tag
id
number <optional>
operationId
- Implements:
-
deleteRelationObj(relation)
-
Parameters:
Name Type Description relation
olympe.dc.transaction.SubGraph.Relation -
forEachRelation(callback)
-
Call the callback given as parameter once for each relation present in the graph (and pass this relation as argument)
Parameters:
Name Type Description callback
function -
forEachRelationInOrder(callback)
-
Call the callback given as parameter once for each relation present in the graph (and pass this relation as argument), calling the relations in order.
Parameters:
Name Type Description callback
function -
getId()
-
Return the patch id
- Implements:
Returns:
- Type
- string
-
getInstances()
-
Get a map with all instances of this SubGraph indexed with by tag
Returns:
- Type
- Map.<string, olympe.dc.transaction.SubGraph.Instance>
-
getRelationsOfInstance(tag, propTag)
-
Returns all outgoing relations of the specified type linked to the specified instance.
Parameters:
Name Type Description tag
string propTag
string Returns:
- Type
- Array.<olympe.dc.transaction.SubGraph.Relation>
-
getRelationTagsOfInstance(tag, propTag)
-
Parameters:
Name Type Description tag
string propTag
string Returns:
- Type
- Array.<string>
-
getSize()
-
Gets the number of instance and relations contained in this patch
- Implements:
Returns:
- Type
- number
-
hasInstance(tag)
-
Parameters:
Name Type Description tag
string Returns:
- Type
- boolean
-
hasRelation(relation)
-
Parameters:
Name Type Description relation
olympe.dc.transaction.SubGraph.Relation Returns:
- Type
- boolean
-
updateInstance(tag [, properties] [, forceUpdate] [, id])
-
Updates an instance.
- If the instance does not exist, it will be automatically created
- Depending on the implementation, updates will be rejected if the provided "new" version is lower than the stored one
Parameters:
Name Type Argument Default Description tag
string Instance tag
properties
Map.<string, ?*> <optional>
Instance properties
forceUpdate
boolean <optional>
false If true, do not do any version check and accepts any update (used by rollbacks)
id
number <optional>
operationId
- Implements: