comunica / comunica-feature-reasoning

📬 Comunica packages for reasoning during query execution
MIT License
5 stars 5 forks source link

Reasoning against pre-reasoned sources #23

Open jeswr opened 2 years ago

jeswr commented 2 years ago

Expanding upon https://github.com/SolidLabResearch/Challenges/issues/14#issuecomment-1062554186 with some implementation specific ideas.

As a first-pass lets make the following assumptions (which can be verified inside the appropriate actors test method) to simplify the problem:

  1. We have one pre-reasoned source that is reasoned with using the ruleset we wish to apply
  2. We have one non-reasoned source
  3. The rules we are applying are in a premise-conclusion style format (i.e. no quantification, nesting etc.)

As a 'naive' first implementation we can then do the following:

  1. On the first iteration of reasoning with our (already optimized) rule set - we first check the premise of each rule against the 'unreasoned' dataset. If there are no premises that match that rule it is not included in this round of reasoning. If there is a match evaluate the remainder evaluate the rule against both databases, using the matches from the unreasoned dataset as initialBindings.
  2. For each following round of reasoning the logic is similar to 1, except now we create these initialBindings using results produced in the previous iteration of reasoning.

^^ Most of this logic would also be re-usable to optimize the current rule evaluation strategies as well.

jeswr commented 2 years ago

As suggested by @arminhaller - in lieu of metadata about the reasoning status of sources as discussed in https://github.com/SolidLabResearch/Challenges/issues/14#issuecomment-1062554186, we can in some case heuristically determine this based on the presense of data. For example some superset of RDFS inferencing is likely enabled if a triple of the form ?s a rdfs:resource is present.

I suggest we create a bus that takes a source as input and returns the types of reasoning that have been applied to that source. Then one actor can be this heuristic actor, a second actor uses metadata exposed by the source, and a third actor uses the ActionContext in cases where users have explicitly stated the pre-reasoning done on sources.

jeswr commented 2 years ago

One can possibly view this reduced problem as one of 'incremental reasoning' - where the pod data can be abstractly considered as an 'insertion' into the main KB.

jeswr commented 2 years ago

For extra points - handle dialogical reasoning https://github.com/SolidLabResearch/Challenges/issues/22