quadstorejs / quadstore

A LevelDB-backed graph database for JS runtimes (Node.js, Deno, browsers, ...) supporting SPARQL queries and the RDF/JS interface.
https://github.com/quadstorejs/quadstore
MIT License
203 stars 14 forks source link

Allow del with matchPattern #32

Closed jmatsushita closed 7 years ago

jmatsushita commented 7 years ago

Hi there,

I ran into something I found counter-intuitive. I was trying out db.patch and then switched to db.del and couldn't understand why the delete didn't occur until I realised (reading the doc) that del doesn't support the matchPattern syntax. It would be quite nice for consistency (and functionality) if del acted like the first argument of patch (array means actual deletes, and single object means matchPattern).

Also it might be useful to have a delExisting method like in LD-PATCH and possibly a putNew (like addNew) method?

Finally, being able to use the query interface with filters and joins to delete would be nice. Maybe using the chaining syntax? Maybe using .get() instead of toArray would make a .del() fit nicely at the end of the chain?

Cheers,

Jun

jmatsushita commented 7 years ago

Of course a quick workaround was to use .patch(matchPattern, [], done)

jacoscaz commented 7 years ago

@jmatsushita could you please create a different issue for each of these points? I think they're all very good and deserve to be tracked separately.

jmatsushita commented 7 years ago

There you go :)

jacoscaz commented 7 years ago

@jmatsushita this one should now work as expected. We'll release on NPM over the next few days.

jmatsushita commented 7 years ago

Great!

jacoscaz commented 7 years ago

We have now released this feature in version 2.1.1. Closing this one, bugs should go into dedicated issues.