我想使用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 client docs,有两种获得结果的方法:
collect_concepts()
当我迭代时,我不能使用.map()
我得到AttributeError: 'ConceptSet' object has no attribute 'map'
当我尝试collect_concepts
时,我得到GraknError: Only use .collect_concepts on ConceptMaps returned by query()
map()
和collect_concepts
(将在下一版本的客户端Python中removed)是ConceptMap
应答类型的方法。作为compute cluster
查询的结果返回的是ConceptSet
答案类型ConceptSet
具有set()
方法,该方法在集群计算后返回概念的ID集Here您将找到查询类型及其相应的答案类型,here您将在^{上找到有关
set()
方法的文档相关问题 更多 >
编程相关推荐