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

Dataset quads and objects don't find the same data #2944

Open
drewp opened this issue Oct 22, 2024 · 2 comments
Open

Dataset quads and objects don't find the same data #2944

drewp opened this issue Oct 22, 2024 · 2 comments

Comments

@drewp
Copy link
Contributor

drewp commented Oct 22, 2024

    g = Dataset()
    g.parse(file=Path('fixed_config.n3').open('rt'), format='n3')
    g.parse(file=Path('ui_selections.n3').open('rt'), format='n3')
    g.parse(source='http://10.43.160.4/graph/currentEvents', format='trig')

            for ev in g.quads((cal, EV['event'], None, None)):
                log.info(f'    found an event1 {ev}')
            for ev in g.objects((cal, EV['event'], None, None)):
                log.info(f'    found an event2 {ev}')

The first log prints once but the second does not. I expected the queries to match the same statements (returning a quad in log1 or a the quad's object node in log2).

@edmondchuc
Copy link
Contributor

What result do you get if you enable default union on the Dataset object?

g = Dataset(default_union=True)

@mbrock
Copy link

mbrock commented Nov 28, 2024

I just spent some hours being confused by this. Indeed, enabling default_union fixes the problem.

Without that setting, dataset.triples((s, p, o)) only iterates over the default graph, unlike .quads((s, p, o, None)).

That may be intentional, but the documentation for Dataset explicitly says that "querying triples return them all regardless of the graph" which as far as I can tell is not true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@mbrock @drewp @edmondchuc and others