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

Give pointers for forward/backward chaining #141

Open
VladimirAlexiev opened this issue Feb 23, 2023 · 5 comments
Open

Give pointers for forward/backward chaining #141

VladimirAlexiev opened this issue Feb 23, 2023 · 5 comments
Labels
defer Deferring this issue until we have established the N3 standard.

Comments

@VladimirAlexiev
Copy link
Contributor

https://w3c.github.io/N3/spec/#n3rulechaining:

A detailed discussion of these two reasoning modes, their subtle differences and impacts on performance, is beyond the scope of this primer.

That is fair.
However, please provide some references to info about forward/backward chaining, in particular their sequencing/interaction.

  • @josd I've seen some advanced interaction in eye tests, can you give pointers?
  • @doerthe, something from your thesis?
  • @william-vw, does Jen3 have such interactions?

BTW change the last word "primer" -> "specification"
because the doc does start with "This document defines Notation 3"

@doerthe
Copy link
Contributor

doerthe commented Feb 23, 2023

I did not describe that in my thesis, but you are right, it would be nice to have a document about that and we need to write one.

In general: forward-rules are executed till we get the full answer to our query (starting from the facts), backward-rules are executed "on demand" when the body of a rule requires the information (in that sense starting from the query or the queries). But instead of an informal(and incomplete) text as the answer to your issue you deserve a document. I will bring that up in our next group meeting.

@VladimirAlexiev
Copy link
Contributor Author

I understand the general principle but

  • are forward and backward ever interleaved? Or all forward are run first?
  • what happens if I insert a rule as part of executing another rule?
  • are rules scoped?

@william-vw
Copy link
Collaborator

are forward and backward ever interleaved? Or all forward are run first?

As far as I understand, forward rules are executed first; evaluating statements in their rule body (condition) may involve running backward rules. I.e., backward-chaining rules are executed purely "on-demand", when needed. But, @josd and @doerthe may shed more light here.

what happens if I insert a rule as part of executing another rule?

Then this rule will become part of the ruleset and will be executed as well. Try the example here:
https://n3-editor.herokuapp.com/n3/editor/s/cL2VhgAd

are rules scoped?

Unsure what you mean.

@VladimirAlexiev
Copy link
Contributor Author

VladimirAlexiev commented Mar 14, 2023

@william-vw @josd @doerthe

Hybrid reasoning

forward and backward ever interleaved?

Rule dynamics

  • If I insert new triples, are all rules that can match the triples, fired anew?

if I insert a rule X as part of executing another rule A ?

  • If I delete A, will X be deleted?

Rule scoping

are rules scoped?
For example, at https://jena.apache.org/documentation/inference/#RULEsyntax we can see:

[allID: (?C rdf:type owl:Restriction), (?C owl:onProperty ?P),
     (?C owl:allValuesFrom ?D)  -> (?C owl:equivalentClass all(?P, ?D)) ]
[all2: (?C rdfs:subClassOf all(?P, ?D)) -> 
   print(‘Rule for ‘, ?C)
   [all1b: (?Y rdf:type ?D) <- (?X ?P ?Y), (?X rdf:type ?C) ]    ### I mean this
]
  • RULEhybrid also says "we can use the forward rules to compile a set of backward rules from the ontology information in the dataset"
  • is it the same with N3?

@josd
Copy link
Collaborator

josd commented Mar 14, 2023

This is how it works in EYE https://eyereasoner.github.io/eye/#architecture-and-design

@william-vw william-vw added the defer Deferring this issue until we have established the N3 standard. label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defer Deferring this issue until we have established the N3 standard.
Projects
None yet
Development

No branches or pull requests

4 participants