def update_by_id(cls, id_, **kwargs): node = NodeMatcher(graph_).match(cls.__name__, id=id_).first() if node is None: raise Exception(f"{cls.__name__} not found") else: node.update(kwargs) graph_.push(node)
def update_by_id(cls, id_, **kwargs): node = NodeMatcher(graph_).match("Policy", id=id_).first() if node is None: raise Exception("policy not found") else: node.update(kwargs) graph_.push(node)
def update_by_id(cls, id_, *args, **kwargs): node = NodeMatcher(graph_).match(id=id_).first() if node is None: raise Exception(f"node {id_} not found") else: # node.labels.update(args) node.update(kwargs) graph_.push(node)
def update_by_id(cls, id_, **kwargs): # if kwargs.get("value", None) not in PredicateValue: # raise Exception(f"predicate value must in {PredicateValue}") node = NodeMatcher(graph_).match(cls.__name__, id=id_).first() if node is None: raise Exception(f"{cls.__name__} not found") else: node.update(kwargs) graph_.push(node)
def update_by_id(cls, id_, *args, **kwargs): for arg in args: if arg not in ObjectType and arg != cls.__name__: raise Exception(f"label must in {ObjectType,cls.__name__}") node = NodeMatcher(graph_).match(cls.__name__, id=id_).first() if node is None: raise Exception(f"{cls.__name__} not found") else: node.labels.update(args) node.update(kwargs) graph_.push(node)