Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Create generic pattern-match object #64

Open
jeswr opened this issue Apr 14, 2022 · 2 comments
Open

Chore: Create generic pattern-match object #64

jeswr opened this issue Apr 14, 2022 · 2 comments

Comments

@jeswr
Copy link
Member

jeswr commented Apr 14, 2022

Issue type:

  • ➕ Feature request

Description:

To structure capture the logic we have for keeping track of combined lazy/incremental reasoning. It should adhere to the following interface:

interface Patterns {
  // Adds a pattern
  add(quad: RDF.BaseQuad, done?: Promise<void>): boolean;
  // Invalidate all patterns matching {quad}
  invalidate(quad: RDF.BaseQuad): boolean;
  // Check if there is a pattern matching {quad}. For instance if (?s, a, Person) has already been
  // `add`ed then, has((?s, a, Person) and has((Jesse, a, Person)) should be true, while has((?s, a, Agent)) should be false.
  // {resolved} Whether or not the pattern matching must be resolved. Default is false
  has(quad: RDF.BaseQuad, resolved?: boolean): boolean;
  // Resolves when any pattern matching {quad} is resolved
  awaitPattern(quad: RDF.BaseQuad): Promise<void>; 
}

I think this will also be useful in the core of Comunica @rubensworks. Rather than caching AsyncIterators for remotely retrieved data, it can instead be cached inside an N3Store; and retrieved patterns are stored in the data structure adhering to the above interface.

@github-actions
Copy link

Thanks for the suggestion!

@rubensworks
Copy link
Member

Important to keep memory in mind here. The implementation of this could require some kind of lru-cache.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants