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

Extending quadstore #40

Closed jacoscaz closed 7 years ago

jacoscaz commented 7 years ago

What if someone requires additional indexes for context-specific queries? How can quadstore support extensions?

Additional methods

registerIndex(String indexName, Function keyGenerator)
queryIndex(String indexName, Object opts) and queryIndexStream(String indexName, Object opts)

Other stuff

jmatsushita commented 7 years ago

Would registerIndex create a new index or use an existing one? It would be good to use an existing one to benefit from the leveldb ecosystem.

jmatsushita commented 7 years ago

Ah think I see, you do mean an existing one, but it needs to be registered to match keys during the joins? I think I need to think more about this and play with search-index to contribute better to the conversation :) The main use case I was thinking of was to reuse a search index with a quadstore instance.

jacoscaz commented 7 years ago

@jmatsushita have a look at https://github.com/jacoscaz/node-quadstore/blob/indexes/test/quadstore.js#L672 . It's a basic demonstration of the api I was thinking about. The test implements an index that would take care of #39 . What do you think?

jacoscaz commented 7 years ago

@jmatsushita ?

jacoscaz commented 7 years ago

See pull request #42

jacoscaz commented 7 years ago

Closing, available on NPM in quadstore@2.2.0-alpha .