当前位置: 首页>>代码示例>>Python>>正文


Python QueryLauncher.process_query方法代码示例

本文整理汇总了Python中askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher.process_query方法的典型用法代码示例。如果您正苦于以下问题:Python QueryLauncher.process_query方法的具体用法?Python QueryLauncher.process_query怎么用?Python QueryLauncher.process_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher的用法示例。


在下文中一共展示了QueryLauncher.process_query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: delete_askograph

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def delete_askograph(self):
        """Delete the askomics graph"""

        sqb = SparqlQueryGraph(self.settings, self.request.session)
        query_laucher = QueryLauncher(self.settings, self.request.session)

        query_laucher.process_query(sqb.get_drop_named_graph('urn:sparql:test_askomics'))
开发者ID:askomics,项目名称:askomics,代码行数:9,代码来源:interface_tps_db.py

示例2: delete_apikey

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def delete_apikey(self, key):
        """delete an apikey"""

        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        query_laucher.process_query(sqa.delete_apikey(key).query)
开发者ID:abretaud,项目名称:askomics,代码行数:9,代码来源:Security.py

示例3: positionable_attr

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [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

示例4: update_email

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def update_email(self):
        """
        change the mail of a user
        """
        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        query_laucher.process_query(sqa.update_mail(self.username, self.email).query)
开发者ID:ofilangi,项目名称:askomics,代码行数:10,代码来源:Security.py

示例5: delete_galaxy

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def delete_galaxy(self):
        """Delete galaxy triple for the user"""


        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        query_laucher.process_query(sqa.delete_galaxy(self.username).query)
开发者ID:abretaud,项目名称:askomics,代码行数:10,代码来源:Security.py

示例6: update_passwd

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def update_passwd(self):
        """
        Change the password of a user, and his randomsalt
        """
        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        query_laucher.process_query(sqa.update_passwd(self.username, self.sha256_pw, self.randomsalt).query)
开发者ID:ofilangi,项目名称:askomics,代码行数:10,代码来源:Security.py

示例7: statistics

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def statistics(self):
        """ Get information about triplet store """
        self.log.debug("== STATS ==")
        data = {}
        pm = ParamManager(self.settings, self.request.session)

        sqb = SparqlQueryBuilder(self.settings, self.request.session)
        ql = QueryLauncher(self.settings, self.request.session)
        tse = TripleStoreExplorer(self.settings, self.request.session)

        results = ql.process_query(sqb.get_statistics_number_of_triples().query)
        data["ntriples"] = results[0]["no"]

        results = ql.process_query(sqb.get_statistics_number_of_entities().query)
        data["nentities"] = results[0]["no"]

        results = ql.process_query(sqb.get_statistics_distinct_classes().query)
        data["nclasses"] = results[0]["no"]

        # Get the list of classes
        res_list_classes = ql.process_query(sqb.get_statistics_list_classes().query)

        data["class"] = {}
        for obj in res_list_classes:
            class_name = pm.remove_prefix(obj['class'])
            data["class"][class_name] = {}

        # Get the number of instances by class
        res_nb_instances = ql.process_query(sqb.get_statistics_nb_instances_by_classe().query)

        for obj in res_nb_instances:
            if 'class' in obj:
                class_name = pm.remove_prefix(obj['class'])
                data["class"][class_name]["count"] = obj['count']

        # Get details on relations for each classes
        for obj in res_list_classes:
            if 'class' in obj:
                class_name = pm.remove_prefix(obj['class'])
                uri = obj['class']

                shortcuts_list = tse.has_setting(uri, 'shortcut')

                src = Node(class_name, # We don't care about counter in stats
                    uri,
                    class_name,
                    shortcuts_list)

                attributes, nodes, links = tse.get_neighbours_for_node(src, None)

                data["class"][class_name]["attributes"] = [a.to_dict() for a in attributes]
                data["class"][class_name]["neighbours"] = [n.to_dict() for n in nodes]
                data["class"][class_name]["relations"] = [l.to_dict() for l in links]

        return data
开发者ID:Piezoid,项目名称:askomics,代码行数:57,代码来源:ask_view.py

示例8: add_apikey

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def add_apikey(self, keyname):
        """Add an api key

        :param keyname: the keyname
        :type keyname: string
        """

        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        query_laucher.process_query(sqa.add_apikey(self.username, keyname).query)
开发者ID:abretaud,项目名称:askomics,代码行数:13,代码来源:Security.py

示例9: compare_file_to_database

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def compare_file_to_database(self, headers):
        """ Ask the database to compare the headers of a file to convert to the corresponding class in the database """
        curr_entity = headers[0]
        sqb = SparqlQueryBuilder(self.settings, self.session)
        ql = QueryLauncher(self.settings, self.session)
        sparql_template = self.get_template_sparql(self.ASKOMICS_get_class_info_from_abstraction_queryFile)
        query = sqb.load_from_file(sparql_template, {"#nodeClass#": curr_entity}).query

        results = ql.process_query(query)
        if results == []:
            return [], headers, []
        bdd_relations, new_headers, missing_headers, present_headers = [], [], [], []
        for result in results:
            bdd_relation = result["relation"].replace(self.get_param("askomics.prefix"), "").replace("has_", "")
            bdd_relations.append(bdd_relation)
            if bdd_relation not in headers:
                self.log.warning('Relation "%s" not found in tables columns: %s.', bdd_relation, repr(headers))
                missing_headers.append(bdd_relation)
        for header in headers:
            if header != curr_entity:
                if header not in bdd_relations:
                    self.log.info('Adding column "%s".', header)
                    new_headers.append(header)
                elif header not in missing_headers:
                    present_headers.append(header)
        return missing_headers, new_headers, present_headers
开发者ID:odameron,项目名称:askomics,代码行数:28,代码来源:SourceFileConvertor.py

示例10: test_triple_presence

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def test_triple_presence(self, graph, triple):
        """Test the presence of a triple in the triplestore

        get if a triple is present in a specific graph of the triplestore
        :param graph: the named graph
        :type graph: string
        :param triple: the triple to test
        :type triple: string
        :returns: Result of the test
        :rtype: bool
        """

        sqb = SparqlQueryGraph(self.settings, self.request.session)
        query_laucher = QueryLauncher(self.settings, self.request.session)


        query = sqb.prepare_query("""
            SELECT count(*) AS ?count
            WHERE {
                GRAPH <""" + graph + """> {
                    """ + triple + """ .
                }
            }
            """)

        res = query_laucher.process_query(query)

        print(bool(int(res[0]['count'])))

        return bool(int(res[0]['count']))
开发者ID:askomics,项目名称:askomics,代码行数:32,代码来源:interface_tps_db.py

示例11: get_start_points

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def get_start_points(self):
        """
        Get the possible starting points for your graph.

        :return: List of starting points
        :rtype: Node list
        """
        self.log.debug(" =========== TripleStoreExplorer:get_start_points ===========")
        nodes = []

        sqg = SparqlQueryGraph(self.settings, self.session)
        ql = QueryLauncher(self.settings, self.session)
        results = ql.process_query(sqg.get_start_point().query)

        for result in results:
            g  = result["g"]
            uri = result["nodeUri"]
            label = result["nodeLabel"]

            if 'private' in result['accesLevel']:
                public = False
                private = True
            else:
                public = True
                private = False

            nodes.append({'g': g, 'uri': uri, 'label': label, 'public': public, 'private': private})

        return nodes
开发者ID:ofilangi,项目名称:askomics,代码行数:31,代码来源:TripleStoreExplorer.py

示例12: empty

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def empty(self):
        """Delete all test data

        Get the list of all public and private graphs and delete them
        """

        sqb = SparqlQueryGraph(self.settings, self.request.session)
        query_laucher = QueryLauncher(self.settings, self.request.session)
        private_graphs = self.list_private_graphs()
        public_graphs = self.list_public_graphs()

        for graph in private_graphs:
            query_laucher.process_query(sqb.get_delete_query_string(graph))

        for graph in public_graphs:
            query_laucher.process_query(sqb.get_delete_query_string(graph))
开发者ID:askomics,项目名称:askomics,代码行数:18,代码来源:interface_tps_db.py

示例13: check_galaxy

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def check_galaxy(self):
        """Check if user have galaxy triples"""

        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        result = query_laucher.process_query(sqa.check_galaxy(self.username).query)

        return ParamManager.Bool(result[0]['status'])
开发者ID:ofilangi,项目名称:askomics,代码行数:11,代码来源:Security.py

示例14: set_username_by_email

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def set_username_by_email(self):
        """Get the username of a user by his email"""

        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        result = query_laucher.process_query(sqa.get_username_by_email(self.email).query)

        # return result[0]['username']
        self.username = result[0]['username']
开发者ID:ofilangi,项目名称:askomics,代码行数:12,代码来源:Security.py

示例15: get_galaxy_infos

# 需要导入模块: from askomics.libaskomics.rdfdb.QueryLauncher import QueryLauncher [as 别名]
# 或者: from askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher import process_query [as 别名]
    def get_galaxy_infos(self):
        """Get Galaxy url and apikey of a user"""

        query_laucher = QueryLauncher(self.settings, self.session)
        sqa = SparqlQueryAuth(self.settings, self.session)

        result = query_laucher.process_query(sqa.get_galaxy_infos(self.username).query)

        if result:
            return result[0]
        return []
开发者ID:ofilangi,项目名称:askomics,代码行数:13,代码来源:Security.py


注:本文中的askomics.libaskomics.rdfdb.QueryLauncher.QueryLauncher.process_query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。