cymple.builder.NodeAfterMergeAvailable

class cymple.builder.NodeAfterMergeAvailable(query)

Bases: RelationAfterMerge, Return, Delete, OperatorStart, OperatorEnd, SetAfterMerge, OnCreate, OnMatch, QueryStartAvailable

A class decorator declares a NodeAfterMerge is available in the current query.

__init__(query)

Initialize the query object.

Methods

__init__(query)

Initialize the query object.

call()

Concatenate the "CALL" clause.

create()

Concatenate the "CREATE" clause.

cypher(cypher_query_str)

Concatenate a cypher query string

delete(ref_name)

Concatenate a DELETE clause for a referenced instance from the DB.

detach_delete(ref_name)

Concatenate a DETACH DELETE clause for a referenced instance from the DB.

get()

Get the final query string .

match()

Concatenate the "MATCH" clause.

match_optional()

Concatenate the "MATCH" clause.

merge()

Concatenate the "MERGE" clause.

on_create()

Concatenate the "ON CREATE" clause.

on_match()

Concatenate the "ON MATCH" clause.

operator_end()

Concatenate the "OPERATOR END" clause.

operator_start(operator[, ref_name, args])

Concatenate an operator (e.g. ShortestPath), where its result may be given a name for future reference.

related([label, ref_name, properties, ...])

Concatenate an undirectional (i.e. --) graph Relationship, which may be filtered.

related_from([label, ref_name, properties, ...])

Concatenate a backward (i.e. <--) graph Relationship, which may be filtered.

related_to([label, ref_name, properties, ...])

Concatenate a forward (i.e. -->) graph Relationship, which may be filtered.

return_literal(literal)

Concatenate a literal RETURN statement.

return_mapping(mappings)

Concatenate a RETURN statement for multiple objects.

set(properties[, escape_values])

Concatenate a SET clause, using the given properties map.

with_(variables)

Concatenate a WITH clause, keeping one or more variables given in 'variables' arg.

call()

Concatenate the “CALL” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

CallAvailable

create()

Concatenate the “CREATE” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

CreateAvailable

cypher(cypher_query_str)

Concatenate a cypher query string

delete(ref_name: str)

Concatenate a DELETE clause for a referenced instance from the DB.

Parameters:

ref_name (str) – The reference name to be used for the delete operation

Returns:

A Query object with a query that contains the new clause.

Return type:

DeleteAvailable

detach_delete(ref_name: str)

Concatenate a DETACH DELETE clause for a referenced instance from the DB.

Parameters:

ref_name (str) – The reference name to be used for the delete operation

Returns:

A Query object with a query that contains the new clause.

Return type:

DeleteAvailable

get()

Get the final query string .

match()

Concatenate the “MATCH” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

MatchAvailable

match_optional()

Concatenate the “MATCH” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

MatchAvailable

merge()

Concatenate the “MERGE” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

MergeAvailable

on_create()

Concatenate the “ON CREATE” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

OnCreateAvailable

on_match()

Concatenate the “ON MATCH” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

OnMatchAvailable

operator_end()

Concatenate the “OPERATOR END” clause.

Returns:

A Query object with a query that contains the new clause.

Return type:

OperatorEndAvailable

operator_start(operator: str, ref_name: str | None = None, args: dict | None = None)

Concatenate an operator (e.g. ShortestPath), where its result may be given a name for future reference.

Parameters:
  • operator (str) – The neo4j operator to be used (e.g. ShortestPath)

  • ref_name (str) – A reference name of the result, to be used later in the rest of the query, defaults to None

  • args (dict) – A dict of arguments, to be passed to the operator function, defaults to None

Returns:

A Query object with a query that contains the new clause.

Return type:

OperatorStartAvailable

related(label: str | None = None, ref_name: str | None = None, properties: dict | None = None, min_hops: int = 1, max_hops: int = 1, **kwargs)

Concatenate an undirectional (i.e. –) graph Relationship, which may be filtered.

Parameters:
  • label (str) – The relationship label (type) in the DB, defaults to None

  • ref_name (str) – A reference name to be used later in the rest of the query, defaults to None

  • properties (dict) – A dict representing the set of properties by which the relationship is filtered, defaults to None

  • min_hops (int) – The minimal desired number of hops (set -1 for maximum boundary only), defaults to 1

  • max_hops (int) – The maximal desired number of hops (set -1 for minimal boundary only), defaults to 1

  • **kwargs

    kwargs

:type **kwargs

Returns:

A Query object with a query that contains the new clause.

Return type:

RelationAfterMergeAvailable

related_from(label: str | None = None, ref_name: str | None = None, properties: dict = {}, min_hops: int = 1, max_hops: int = 1, **kwargs)

Concatenate a backward (i.e. <–) graph Relationship, which may be filtered.

Parameters:
  • label (str) – The relationship label (type) in the DB, defaults to None

  • ref_name (str) – A reference name to be used later in the rest of the query, defaults to None

  • properties (dict) – A dict representing the set of properties by which the relationship is filtered, defaults to {}

  • min_hops (int) – The minimal desired number of hops (set -1 for maximum boundary only), defaults to 1

  • max_hops (int) – The maximal desired number of hops (set -1 for minimal boundary only), defaults to 1

  • **kwargs

    kwargs

:type **kwargs

Returns:

A Query object with a query that contains the new clause.

Return type:

RelationAfterMergeAvailable

related_to(label: str | None = None, ref_name: str | None = None, properties: dict = {}, min_hops: int = 1, max_hops: int = 1, **kwargs)

Concatenate a forward (i.e. –>) graph Relationship, which may be filtered.

Parameters:
  • label (str) – The relationship label (type) in the DB, defaults to None

  • ref_name (str) – A reference name to be used later in the rest of the query, defaults to None

  • properties (dict) – A dict representing the set of properties by which the relationship is filtered, defaults to {}

  • min_hops (int) – The minimal desired number of hops (set -1 for maximum boundary only), defaults to 1

  • max_hops (int) – The maximal desired number of hops (set -1 for minimal boundary only), defaults to 1

  • **kwargs

    kwargs

:type **kwargs

Returns:

A Query object with a query that contains the new clause.

Return type:

RelationAfterMergeAvailable

return_literal(literal: str)

Concatenate a literal RETURN statement.

Parameters:

literal (str) – A Cypher string describing the objects to be returned, referencing name/names which were defined earlier in the query

Returns:

A Query object with a query that contains the new clause.

Return type:

ReturnAvailable

return_mapping(mappings: List[Mapping])

Concatenate a RETURN statement for multiple objects.

Parameters:

mappings (List[Mapping]) – The mapping (or a list of mappings) of db property names to code names, to be returned

Returns:

A Query object with a query that contains the new clause.

Return type:

ReturnAvailable

set(properties: dict, escape_values: bool = True)

Concatenate a SET clause, using the given properties map.

Parameters:
  • properties (dict) – A dict to be used to set the variables with their corresponding values

  • escape_values (bool) – Determines whether the properties values should be escaped or not, defaults to True

Returns:

A Query object with a query that contains the new clause.

Return type:

SetAfterMergeAvailable

with_(variables: str)

Concatenate a WITH clause, keeping one or more variables given in ‘variables’ arg.

Parameters:

variables (str) – A string refering to previously obtained variables, comma seperated

Returns:

A Query object with a query that contains the new clause.

Return type:

WithAvailable