本文整理汇总了Python中askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder.get_common_positionable_attributes方法的典型用法代码示例。如果您正苦于以下问题:Python SparqlQueryBuilder.get_common_positionable_attributes方法的具体用法?Python SparqlQueryBuilder.get_common_positionable_attributes怎么用?Python SparqlQueryBuilder.get_common_positionable_attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder
的用法示例。
在下文中一共展示了SparqlQueryBuilder.get_common_positionable_attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: positionable_attr
# 需要导入模块: from askomics.libaskomics.rdfdb.SparqlQueryBuilder import SparqlQueryBuilder [as 别名]
# 或者: from askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder import get_common_positionable_attributes [as 别名]
def positionable_attr(self):
"""
Return the positionable attributes in common between two positionable entity
"""
#FIXEME: Rewrite this ugly method
body = self.request.json_body
data = {}
sqb = SparqlQueryBuilder(self.settings, self.request.session)
ql = QueryLauncher(self.settings, self.request.session)
# Check if the two entity are positionable
positionable1 = ql.process_query(sqb.get_if_positionable(body['node']).query)
positionable2 = ql.process_query(sqb.get_if_positionable(body['node']).query)
if positionable1 == 0 or positionable2 == 0:
data['error'] = 'not positionable nodes'
return data
results = ql.process_query(sqb.get_common_positionable_attributes(body['node'], body['second_node']).query)
self.log.debug(results)
data['results'] = {}
list_pos_attr = []
for elem in results:
if elem['pos_attr'] not in list_pos_attr:
list_pos_attr.append(elem['pos_attr'].replace("http://www.semanticweb.org/irisa/ontologies/2016/1/igepp-ontology#", ""))
for elem in list_pos_attr:
data['results'][elem] = False not in [bool(int(p['status'])) for p in results if p['pos_attr'] == "http://www.semanticweb.org/irisa/ontologies/2016/1/igepp-ontology#"+elem]
return data