python - 如何在 Grakn 中使用 Python 客户端计算连接组件
问题描述
我想使用 Python 客户端获取集群(或连接的组件)。我可以用 graql 做到这一点:
compute cluster in [company, c2c], using connected-component, where contains=V86179944;
我也可以使用 Python 运行查询:
query = "compute cluster in [company, c2c], using connected-component, where contains=V86179944;"
with GraknClient(uri="localhost:48555") as client:
with client.session(keyspace=keyspace) as session:
with session.transaction().read() as transaction:
answer_iterator = transaction.query(query)
# What to do here??
但是,我不知道如何访问结果。根据python 客户端文档,有两种获取结果的方法:
- 迭代
- 利用
collect_concepts()
当我迭代时,我不能使用.map()
我得到AttributeError: 'ConceptSet' object has no attribute 'map'
当我尝试collect_concepts
时,我得到GraknError: Only use .collect_concepts on ConceptMaps returned by query()
解决方案
推荐阅读
- c - C将数组初始化为函数内部的指针
- python - 根据列表pyspark的字符串计算包含子字符串的多列中的值
- mongodb - 使用 MongoDB mongo go 驱动程序进行计数器持久收集
- javascript - 如何在javascript中使用EventListener下拉或隐藏和显示子菜单?
- ios - NSDate 将格式设置为 MM/YYYY 但结果显示 dd/YYYY
- c - c中的openmp并行递归函数
- powershell - 在 PowerShell (Sharepoint Online) 中运行命令后生成 CSV/TXT
- css - 使用具体化 css 在工具提示中显示图像
- jquery - 提交 JQuery 表单发布请求时页面不工作
- sql - psql 中输入的 SQL 命令是属于 SQL(Postgresql 的 SQL 方言)还是 PL/PgSQL?