From 82f87fbd75436f20ef715c8cfc3ff988e11d6714 Mon Sep 17 00:00:00 2001 From: Thomas Tanon Date: Sun, 27 Oct 2024 12:35:30 +0100 Subject: [PATCH] Fixes Store.triples --- oxrdflib/_converter.py | 8 +++----- oxrdflib/store.py | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/oxrdflib/_converter.py b/oxrdflib/_converter.py index 6123680..f5ce721 100644 --- a/oxrdflib/_converter.py +++ b/oxrdflib/_converter.py @@ -1,15 +1,13 @@ -from typing import TYPE_CHECKING, Optional, Tuple, Union +from typing import Optional, Tuple, Union import pyoxigraph as ox from rdflib import Graph from rdflib.graph import DATASET_DEFAULT_GRAPH_ID +from rdflib.store import Store from rdflib.term import BNode, Literal, Node, URIRef from oxrdflib._type import _Quad, _Triple, _TriplePattern -if TYPE_CHECKING: - from oxrdflib.store import OxigraphStore - def to_ox( term: Optional[Union[Node, _Triple, _Quad, Graph]], context: Optional[Graph] = None @@ -83,7 +81,7 @@ def to_ox_term_pattern( def from_ox_graph_name( graph_name: Union[ox.NamedNode, ox.BlankNode, ox.DefaultGraph], - store: "OxigraphStore", + store: Store, ) -> Graph: if isinstance(graph_name, ox.NamedNode): return Graph(identifier=URIRef(graph_name.value), store=store) diff --git a/oxrdflib/store.py b/oxrdflib/store.py index 95ebae3..1eeed82 100644 --- a/oxrdflib/store.py +++ b/oxrdflib/store.py @@ -103,7 +103,7 @@ def triples( return ( ( (from_ox(q.subject), from_ox(q.predicate), from_ox(q.object)), - iter(((from_ox_graph_name(q.graph_name, self) if q.graph_name != ox.DefaultGraph() else None),)), + iter(((from_ox_graph_name(q.graph_name, self)),)), ) for q in self._inner.quads_for_pattern(*to_ox_quad_pattern(triple_pattern, context)) )