Callidon / sparql-engine

🚂 A framework for building SPARQL query engines in Javascript/Typescript
https://callidon.github.io/sparql-engine
MIT License
99 stars 14 forks source link

Bug in levelgraph adapter (`this` not resolving as expected) #60

Closed earthlyreason closed 3 years ago

earthlyreason commented 3 years ago

First, thanks for this fantastic project! It is a thing of beauty.

To Reproduce Steps to reproduce the behavior:

  1. Use the levelgraph adapter (from the examples directory)
  2. Do any update operation (the test program only does a read operation)

Expected behavior Performs update operation

Actual behavior

TypeError: Cannot read property '_db' of undefined

Additional context

The reason for the error is that the insert and delete operations use function expressions in the Promise constructors, which changes the context of this resolution.

I am submitting a PR momentarily.

Callidon commented 3 years ago

Thanks to you for using our framework, it's always a pleasure to see that it is useful to more and more people 😄

I've merged your pull request with the fix. Thank you for solving that, it been so long since we last tested the levelgraph adapter, it's no surprise to me that there are stills bugs in this example.