sqerzo/graph/cypher/redisgraph.py
def update_element(self, graph_element: GraphElement) \
            -> None or SQErzoElementExistException:
        """Redis doesn't support multiple labels -> we'll simulate then"""

        def update_fixed_label_nodes(n) -> Iterable[Tuple[bool, GraphElement]]:
            if len(n.__labels__) > 1:
                #
                # If multiple labels are not supported, then create
                # net node clone with only new labels
                #
                for lb in n.__labels__[1:]:
                    new_node = n.clone(exclude=["identity"])
                    new_node.__labels__ = [lb]

                    yield True, new_node

            else:
                yield False, n

        if not graph_element:
            raise SQErzoElementExistException("Node update needs a valid Node")

        for need_create, n in update_fixed_label_nodes(graph_element):

            # No multiple labels supported. Need to be created a new node
            if need_create:
                q = n.query_create()

            # Multiple labels supported -> update node
            else:
                q = n.query_update()

            self.query(q)

            n.__dirty_properties__.clear()
Redis doesn't support multiple labels -> we'll simulate then
Redis doesn't support multiple labels -> we'll simulate then
Redis doesn ' t support multiple labels - > we ' ll simulate then
def update_element(self, graph_element: GraphElement) \
            -> None or SQErzoElementExistException:
        def update_fixed_label_nodes(n) -> Iterable[Tuple[bool, GraphElement]]:
            if len(n.__labels__) > 1:
                 If multiple labels are not supported, then create
                 net node clone with only new labels
                for lb in n.__labels__[1:]:
                    new_node = n.clone(exclude=["identity"])
                    new_node.__labels__ = [lb]
                    yield True, new_node
            else:
                yield False, n
        if not graph_element:
            raise SQErzoElementExistException("Node update needs a valid Node")
        for need_create, n in update_fixed_label_nodes(graph_element):
             No multiple labels supported. Need to be created a new node
            if need_create:
                q = n.query_create()
             Multiple labels supported -> update node
            else:
                q = n.query_update()
            self.query(q)
            n.__dirty_properties__.clear()
def update_element ( self , graph_element : GraphElement ) -> None or SQErzoElementExistException : def update_fixed_label_nodes ( n ) -> Iterable [ Tuple [ bool , GraphElement ] ] : if len ( n . __labels__ ) > 1 : for lb in n . __labels__ [ 1 : ] : new_node = n . clone ( exclude = [ "identity" ] ) new_node . __labels__ = [ lb ] yield True , new_node else : yield False , n if not graph_element : raise SQErzoElementExistException ( "Node update needs a valid Node" ) for need_create , n in update_fixed_label_nodes ( graph_element ) : if need_create : q = n . query_create ( ) else : q = n . query_update ( ) self . query ( q ) n . __dirty_properties__ . clear ( )
Redis doesn't support multiple labels -> we'll simulate then
Redis doesn ' t support multiple labels - > we ' ll simulate then
"""Redis doesn't support multiple labels -> we'll simulate then""" # # If multiple labels are not supported, then create # net node clone with only new labels # # No multiple labels supported. Need to be created a new node # Multiple labels supported -> update node
self
graph_element
GraphElement