本文整理汇总了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)
示例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")
示例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)