Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes Store.triples #54

Merged
merged 1 commit into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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