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


Python SparqlQueryBuilder.get_drop_named_graph方法代碼示例

本文整理匯總了Python中askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder.get_drop_named_graph方法的典型用法代碼示例。如果您正苦於以下問題:Python SparqlQueryBuilder.get_drop_named_graph方法的具體用法?Python SparqlQueryBuilder.get_drop_named_graph怎麽用?Python SparqlQueryBuilder.get_drop_named_graph使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder的用法示例。


在下文中一共展示了SparqlQueryBuilder.get_drop_named_graph方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: delete_graph

# 需要導入模塊: from askomics.libaskomics.rdfdb.SparqlQueryBuilder import SparqlQueryBuilder [as 別名]
# 或者: from askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder import get_drop_named_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_drop_named_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

示例3: drop_graph

# 需要導入模塊: from askomics.libaskomics.rdfdb.SparqlQueryBuilder import SparqlQueryBuilder [as 別名]
# 或者: from askomics.libaskomics.rdfdb.SparqlQueryBuilder.SparqlQueryBuilder import get_drop_named_graph [as 別名]
 def drop_graph(self, graph):
     sqb = SparqlQueryBuilder(self.settings, self.request.session)
     ql = QueryLauncher(self.settings, self.request.session)
     ql.execute_query(sqb.get_drop_named_graph(graph).query)
開發者ID:cbettemb,項目名稱:askomics,代碼行數:6,代碼來源:interface_tps.py


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