Closed mrkvon closed 7 months ago
Note that this library implements removeMatches as an event emitter; in particular it is implemented as follows https://github.com/rdfjs/N3.js/blob/d3faa57c82c3c46a667bc3e31312f7b5d82ff8da/src/N3Store.js#L357-L367.
So I would not expect the matches to be removed until the end
event of the returned event emitter has been called.
Are there docs / types somewhere that indicate this should be synchronous?
It's because N3.js implements removeMatches
as described in the RDF/JS Stream spec here.
I think the only sync solution is to call getQuads
and then removeQuads
with the result.
I've seen this comment by @RubenVerborgh:
The N3.Store interface is synchronous [...]
Which i guess is slightly incorrect, then.
I hadn't noticed the links to the external specs, thanks @joachimvh for pointing them out, and for the workaround.
Also, thank you all for promptly resolving this. 🙂
Back in 2018 it was correct 😅
When we remove quads from
Store
withremoveMatches
, they seem to stay in theStore
until next tick. I'd expect them to be removed immediately. Also seems to be the case withdeleteGraph
.You can see it reproduced in this code sandbox.
Example code