# This file is part of the Glowtables software # Copyright (C) 2023 Valentin Lorentz # # This program is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License version 3, as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License along with # this program. If not, see . from typing import Iterable import pytest import rdflib from glowtables.sparql import SparqlBackend class RdflibSparqlBackend(SparqlBackend): def __init__(self, graph: rdflib.Graph): self._graph = graph def query(self, query: str) -> Iterable[tuple]: ret = self._graph.query(query) return ret @pytest.fixture() def rdflib_graph(): return rdflib.Graph() @pytest.fixture() def rdflib_sparql(rdflib_graph: rdflib.Graph): return RdflibSparqlBackend(rdflib_graph)