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


Python SparqlQueryBuilder.get_delete_metadatas_of_graph方法代码示例

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


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

示例1: delete_graph

# 需要导入模块: from askomics.libaskomics.rdfdb.SparqlQueryBuilder import SparqlQueryBuilder [as 别名]
# 或者: from askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder import get_delete_metadatas_of_graph [as 别名]
    def delete_graph(self):
        """
        Delete triples from a list of graph
        """
        self.log.debug("=== DELETE SELECTED GRAPHS ===")

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

        graphs = self.request.json_body['namedGraphs']

        for graph in graphs:
            self.log.debug("--- DELETE GRAPH : %s", graph)
            ql.execute_query(sqb.get_drop_named_graph(graph).query)
            #delete metadatas
            ql.execute_query(sqb.get_delete_metadatas_of_graph(graph).query)
开发者ID:cbettemb,项目名称:askomics,代码行数:18,代码来源:ask_view.py

示例2: manageModules

# 需要导入模块: from askomics.libaskomics.rdfdb.SparqlQueryBuilder import SparqlQueryBuilder [as 别名]
# 或者: from askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder import get_delete_metadatas_of_graph [as 别名]
    def manageModules(self,host_url,urimodule,namemodule,active):
        '''
            activate/desactivate module
        '''
        self.log.debug(" --======================> manageModules <========================--- ");
        self.log.debug(" uri:"+urimodule)
        self.log.debug(" namemodule:"+namemodule)
        self.log.debug(" active:"+str(active))

        listMo = self.getListModules()
        mo = None
        for i in listMo:
            if i["uri"] == urimodule:
                mo = i
                break

        if mo == None:
            raise ValueError("Can not find Mo on TPS !")

        ##########################################################################################
        if mo['state'] == 'wait':
            self.log.debug(" ******************  WAIT MODE **************** :" + urimodule)
            return

        self.log.debug(" delete MO state :" + urimodule)
        self.deleteMoState(urimodule)
        self.log.debug(" insert new MO state :"+urimodule)
        self.importMoSate(mo,"wait")
        ql = QueryLauncher(self.settings, self.session)

        if active:

            try:
                self.importRDF(mo,namemodule,host_url)
                #loading owl file
                if 'owl' in self.moduleFiles[namemodule] and self.moduleFiles[namemodule]['owl'].strip() != '':
                    ql.load_data(self.moduleFiles[namemodule]['owl'],mo['graph'])
            except Exception as e:
                self.log.error('failed: ' + str(e))
                self.log.debug(" delete MO state :" + urimodule)
                self.deleteMoState(urimodule)
                self.log.debug(" insert new MO state :"+urimodule)
                self.importMoSate(mo,"off")
                raise e

            self.log.debug(" delete MO state :" + urimodule)
            self.deleteMoState(urimodule)
            self.log.debug(" insert new MO state :"+urimodule)
            self.importMoSate(mo,"ok")
            ##########################################################################################
            # manage owl if dos not exist in the MO file
            if 'rdf' not in self.moduleFiles[namemodule]:
                self.moduleFiles[namemodule]['rdf'] = []
            if len(self.moduleFiles[namemodule]['rdf'])<=0:
                self.moduleFiles[namemodule]['rdf'] = self.generateAbstractAskomicsRDF(mo['graph'])
                self.importRDF(mo,namemodule,host_url,mo['graph'])
                self.saveMo(namemodule)

        else:
            if 'graph' in mo:
                sqb = SparqlQueryBuilder(self.settings, self.session)
                ql.execute_query(sqb.get_drop_named_graph(mo['graph']).query)
                ql.execute_query(sqb.get_delete_metadatas_of_graph(mo['graph']).query)

            self.log.debug(" delete MO state :" + urimodule)
            self.deleteMoState(urimodule)
            self.log.debug(" insert new MO state :"+urimodule)
            self.importMoSate(mo,"off")
开发者ID:ofilangi,项目名称:askomics,代码行数:70,代码来源:ModulesManager.py


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