Class: GraphQuery

GraphQuery

A graphdef is an object that makes possible to operate on a entire cluster of a graph. It always contains a root tag which corresponds to the instance from which to start the query. Then it describes what relations to follow from the root instance.

A graphdef can be implicit: in that case, when the follow rules are "activated" and the relations define the rules (follow or not) by themselves.

A graphdef can be used for different purposes:

  • GET: it will return the graph cluster according to the query
  • DELETE: it will delete the corresponding graph cluster
  • SUBSCRIPTION: same as GET but this will be processed by the datacloud to update the graph database with the result.

new GraphQuery(graphdef, parentContext)

Creates an instance of GraphDef.

Parameters:
Name Type Description
graphdef olympe.dc.GraphDef
parentContext olympe.df.ExecutionContext

Members


<protected, non-null> allBlocks :Map.<string, !olympe.dc.query.GraphQueryBlock>

Type:

<protected, non-null> context :olympe.df.ExecutionContext

Type:

<protected> graphdef :olympe.dc.GraphDef

Type:

<protected> id :string

Type:
  • string

<protected> logger :olympe.logging.Channel

Type:
  • olympe.logging.Channel

<protected, non-null> rootBlockIds :Array.<string>

Type:
  • Array.<string>

<protected> rootTag :string

Type:
  • string

Methods


applyResult(result)

Update the graphdef with the specified result.

Parameters:
Name Type Description
result olympe.dc.query.GraphResult

the graph result


covers(graphQuery)

Checks if a path query is covered by this graphdef

Parameters:
Name Type Description
graphQuery olympe.dc.query.GraphQuery

The graphdef whose coverage by the current GraphQuery must be checked

Returns:
Type
boolean

getBlocks()

Gets the list of all blocks in that graph query.

Returns:

the list of blocks.

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

getDestination()

Return the destination of this graph query (based on the first root tag).

Returns:

the destination

Type
string

getGraphdef()

Returns the graphdef that initiated this graph query.

Returns:
Type
olympe.dc.GraphDef

getId()

Gets the id of the graphdef.

Returns:

the id.

Type
string

getOperation()

Gets the operation associated to this graphdef.

Returns:

the operation.

Type
olympe.dc.GraphDefOperation

getRootBlocks()

Gets the list of blocks representing the first related level present in this graph query.

Returns:

the list of blocks

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

getRootTag()

Gets the root tags of the graphdef.

Returns:

the root tags.

Type
string

instancesIterator()

Return an iterator over all the instances currently covered by this graphdef

Returns:
Type
!Generator.<string> | !Iterable.<string>

isReady()

Return true if the current query is ready.

Returns:
Type
boolean

notificationUpdate(notification)

Update the graphdef with the specified notification.

Parameters:
Name Type Description
notification olympe.dc.query.GraphNotification

The notification.


offReady(id)

Unregister the callback associated to the specified id if any.

Parameters:
Name Type Description
id string
Returns:

true if a callback has been unregistered.

Type
boolean

onDestroy(callback)

Register a callback to call when the graph query context is destroyed

Parameters:
Name Type Description
callback function

The callback to register.


onReady(callback [, id])

Register a callback to execute when the subscription is ready: when the initial result has been processed. If the query is already ready, directly execute the callback

Parameters:
Name Type Argument Description
callback function
id string <optional>
Returns:

the id used to register the callback.

Type
string

release()

Notify this subscription that it can be released, which will trigger its garbage collection


setReady()

Set this graph query as ready and execute the onReady callbacks.

Type Definitions


GraphResultHandler(error, result)

Callback called when the result of a graphdef is received.

Parameters:
Name Type Description
error Error

The error, or null if successful.

result olympe.dc.query.GraphResult

The result.