Skip to content

Commit

Permalink
Fixes Store.triples
Browse files Browse the repository at this point in the history
  • Loading branch information
Tpt committed Oct 27, 2024
1 parent 86b0617 commit 82f87fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions oxrdflib/_converter.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion oxrdflib/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
Expand Down

0 comments on commit 82f87fb

Please sign in to comment.