當前位置: 首頁>>代碼示例>>Python>>正文


Python SparqlQueryBuilder.get_common_positionable_attributes方法代碼示例

本文整理匯總了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
開發者ID:cbettemb,項目名稱:askomics,代碼行數:37,代碼來源:ask_view.py


注:本文中的askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder.get_common_positionable_attributes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。