Class: GraphQueryBlock

GraphQueryBlock

Represents a block of a graphdef. A block corresponds to a unique path from a set of instances, result of a graphdef, to the root instance of the graphdef.


new GraphQueryBlock(relation, parentId)

Parameters:
Name Type Description
relation olympe.dc.query.Relation
parentId string

Methods


<static> fromJSON(json)

Deserializes a GraphQueryBlock from a JSON object or string.

Parameters:
Name Type Description
json string | Object
Returns:
Type
olympe.dc.query.GraphQueryBlock

<static> generateId(relation, parentId)

Parameters:
Name Type Description
relation olympe.dc.query.Relation
parentId string
Returns:

the block id

Type
string

<package> addInstance(tag)

Adds a new instance, result of the graphdef, in this block.

Parameters:
Name Type Description
tag string

the tag of the instance

Returns:

whether the instance has been added and was not already in the block

Type
boolean

addInstances(tags)

Add all instances of the specified array to this block

Parameters:
Name Type Description
tags Iterable.<string>

the list of tags to add


disableEffect()

Disable the effect of this block in the graphdef. (Especially used for delete and update graphdefs).


doesApply()

Tells if this block need to be considered in the graphdef or is just there as link between other blocks.

Returns:

should apply the operation or not

Type
boolean

getAllInstances()

Return the iterator over all tags of instances contained in this block and its children recursively.

Returns:
Type
Generator.<string>

getChildren()

Return the list of children blocks of this block.

Returns:

the list of children

Type
Array.<!olympe.dc.query.GraphQueryBlock>

getId()

Return the id of the block.

Returns:

the block id.

Type
string

getInstances()

Return the iterator over all tags of instances contained in this block.

Returns:
Type
Iterable.<string>

<package> getParentId()

Return the id of the parent block of this.

Returns:

the parent block id

Type
string

getRelation()

Return the relation associated to this block.

Returns:

the associated relation

Type
olympe.dc.query.Relation

hasInstance(instanceTag)

Tells if the block contains the specified instance.

Parameters:
Name Type Description
instanceTag string

the tag of the instance

Returns:

if the block contains the instance or not.

Type
boolean

newChild(relation)

Create a new block, child of this one, with the specified relation. Return the existing one if the relation already exists.

Parameters:
Name Type Description
relation olympe.dc.query.Relation

the relation associated to the child

Returns:

the block newly created

Type
olympe.dc.query.GraphQueryBlock

removeInstance(tag)

Removes the instance with the specified tag.

Parameters:
Name Type Description
tag string

the tag of the instance

Returns:

whether the instance has been removed and was in the block

Type
boolean

toJSON()

Serializes this GraphQueryBlock into a JSON string.

Returns:
Type
string

toString()

Returns:
Type
string