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

Typescript Declarations #90

Closed thatcort closed 4 years ago

thatcort commented 4 years ago

I wrote a Typescript declaration file for this project. I was wondering if you'd be willing to include it within the project (and maintain it if the API changes)? index.d.ts.txt

jacoscaz commented 4 years ago

Hello @thatcort ! Thank you for that. We're actually working on a big quadstore update that will pave the way to support complex searches and native SPARQL queries. Within that work, which will be released in version 7.0, we're also porting the entire project to typescript. To answer your questions, I'd be happy to include the file you've made but that might be made redundant relatively soon, considering that we're rewriting everything in typescript. Incidentally, this will ensure that our typings will always be up to date as the API changes.

jacoscaz commented 4 years ago

Work is happening in this branch: https://github.com/beautifulinteractions/node-quadstore/tree/feature/sparql-and-complex-searches . It's not quite working, yet, but it's getting there.

thatcort commented 4 years ago

Thanks, that's great to know. The type definitions are attached to the issue. I could make a pull request if necessary -- let me know.

Some other unrelated comments regarding my attempts to use the library (please let me know if there's a better forum for this):

I tried using the library with quadstore-sparql and ran into a number of issues: https://github.com/beautifulinteractions/node-quadstore-sparql/issues/2. Will these be addressed as part of the Typescript upgrade?

My next step was going to be trying to adapt the library to use it with sparql-engine (https://github.com/Callidon/sparql-engine). I saw you plan to replace Comunica with something else and am wondering if you've picked a library/direction yet? Also noticed that implementing a count method to estimate the cardinality for a pattern would be helpful for the query planner.

Thanks!

jacoscaz commented 4 years ago

Hello @thatcort .

I'll have a look at your definitions and see whether I can pull them into our current typescript refactor. Thank you for that effort.

WRT the issues you've encountered with quadstore-sparql, yes, we're planning on addressing those as a part of V7.0.0. Our focus for V7.0.0 is lay the foundations for complex searches and native sparql queries. By "native" I mean that we're using SPARQL.js to parse the query into a JSON structure and then translating that structure into a complex search ourselves. We're doing this in an attempt to try and optimize queries by pushing filters down to the storage level rather than having to do all the relevant filtering in memory.

Will these be addressed as part of the Typescript upgrade?

Yes.

I saw you plan to replace Comunica with something else and am wondering if you've picked a library/direction yet?

Yes, rolling out our own SPARQL engine. However, we'd also be open to switching quadstore-sparql to sparql-engine, keeping it around as an alternative/fallback engine while we work on our native one. Would you be interested in contributing?

Also noticed that implementing a count method to estimate the cardinality for a pattern would be helpful for the query planner.

Coming in v.7.0.0!

EDIT: sorry, posted too soon while I was still editing.

thatcort commented 4 years ago

Hi @jacoscaz,

Sure, I'd be happy to contribute. Let me know the best way to get involved. I have to warn you, though, that I only have minimal time available.

thatcort commented 4 years ago

Hi @jacoscaz ,

I updated the type definitions and submitted them to DefinitelyTyped. It's still going through the PR process: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/46166

I also made some progress on using quadstore with sparql-engine. It seems to be working, but I agree that there is a lot of room for optimization by moving more complex searches into the db and using query algebra objects instead of text that needs to be parsed. Let me know if there's a good way to get involved.

jacoscaz commented 4 years ago

Hi @thatcort . I've just merged into devel a whole lot of foundational work, mainly conversion to typescript and preliminary support for complex searches and SPARQL queries. Having a look at that branch might be a good starting point - all tests are passing. Next steps will revolve around pushing filters down to the database and increasing the complexity of supported searches and queries.

jacoscaz commented 4 years ago

As a further update to this, we're now emitting .d.ts files within our build scripts and plan on publishing them to NPM. We should not need to have a dedicated entry at @types/quadstore anymore.