def with_risky_nodes( self: "NQ", risky_nodes_query: Optional["NodeQuery"] = None) -> "NQ": risky_nodes = risky_nodes_query or NodeQuery() # type: NodeQuery risky_nodes._risks = cast("List[RiskQuery]", self) risky_nodes.set_forward_edge_filter("risks", self) cast("List[RiskQuery]", self)._risky_nodes = risky_nodes return self
def with_scope(self: "NQ", scope_query: Optional["NodeQuery"] = None) -> "NQ": scope = scope_query or NodeQuery() # type: NodeQuery scope.set_reverse_edge_filter( "in_scope", self, "scope", ) return self
def get_scope( self: "NQ", match_scope: Optional[NodeQuery] = None, ) -> List[NodeView]: _match_scope = match_scope or NodeQuery() # type: NodeQuery self_node = (LensQuery().with_node_key( eq=self.node_key).with_scope(_match_scope).query_first( self.dgraph_client)) if self_node: cast(LensView, self).scope = self_node.scope return cast(LensView, self).scope
def get_node(self, node_key: str) -> Optional["NodeView"]: return NodeQuery().with_node_key(eq=node_key).query_first( self.dgraph_client)