RDFLib / rdflib

RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.
https://rdflib.readthedocs.org
BSD 3-Clause "New" or "Revised" License
2.18k stars 559 forks source link

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

Open drewp opened 1 month ago

drewp commented 1 month ago
    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 commented 1 month ago

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

g = Dataset(default_union=True)