根据节点id检查节点是否存在
(self, node_id: str)
| 434 | |
| 435 | #################### query method ################# |
| 436 | async def has_node(self, node_id: str) -> bool: |
| 437 | """根据节点id检查节点是否存在""" |
| 438 | SQL = SQL_TEMPLATES["has_node"] |
| 439 | params = {"workspace": self.db.workspace, "node_id": node_id} |
| 440 | # print(SQL) |
| 441 | # print(self.db.workspace, node_id) |
| 442 | res = await self.db.query(SQL, params) |
| 443 | if res: |
| 444 | # print("Node exist!",res) |
| 445 | return True |
| 446 | else: |
| 447 | # print("Node not exist!") |
| 448 | return False |
| 449 | |
| 450 | async def has_edge(self, source_node_id: str, target_node_id: str) -> bool: |
| 451 | """根据源和目标节点id检查边是否存在""" |