Example #1
0
    def clean_triplestore(self):
        """remove all test graph in the triplestore"""
        query = '''
        SELECT ?graph
        WHERE {{
            GRAPH ?graph {{ ?s ?p ?o . }}
            FILTER (strStarts(str(?graph), "{}"))

        }}
        '''.format(self.get_config("triplestore", "default_graph"))

        query_launcher = SparqlQueryLauncher(self.app, {})

        header, data = query_launcher.process_query(query)
        for result in data:
            query_launcher.drop_dataset(result["graph"])
Example #2
0
 def rollback(self):
     """Drop the dataset from the triplestore in case of error"""
     sparql = SparqlQueryLauncher(self.app, self.session)
     sparql.drop_dataset(self.file_graph)