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

Question about subsumption and QueryEquivalenceChecker3.unify #36

Open
falcaopetri opened this issue Jul 22, 2020 · 3 comments
Open

Question about subsumption and QueryEquivalenceChecker3.unify #36

falcaopetri opened this issue Jul 22, 2020 · 3 comments

Comments

@falcaopetri
Copy link
Contributor

Hi,

Consider the rules:

  1. ?a equals ?b => ?a equals ?b
  2. ?a equals ?b => ?a equals B
  3. ?a equals ?b => ?a equals ?b
  4. ?a equals B => ?a equals ?b

As I understand, 1. unifies with 2., and 3. unifies with 4.

Nonetheless, QueryEquivalenceChecker3.unify/areEquivalent returns false in both cases.

This makes sense, since unify returns false when trying to unify a variable with a constant:
https://github.com/lajus/amie/blob/40ebfa61e4e8bbf488e5fb1fc93b69ba791a8cab/rules/src/main/java/amie/rules/QueryEquivalenceChecker3.java#L30-L31.

In #13 (comment), @lajus said that areEquivalent checks subsumption, but it doesn't seem to be the case.

I'm reporting this behavior because I am not sure if its a bug, an intended behavior, or if I'm using it wrong. I guess that AMIE actually implements a specific version of "subsumption". For example, if it returned true for areEquivalent(3., 4.), the instantiated rule would be discarded.

Regards,
Antonio.

@lajus
Copy link
Contributor

lajus commented Jul 23, 2020

Hi,

I realized later that my statement in #13 was wrong as indeed I did not consider instantiations (just (bijective) variable renaming). There are also other edge cases to consider as the mapping is not required to be injective in the subsumption case (two variables may be mapped to the same variable).

It is in my Todo list with a very low priority as Rule.unify does the job for now (except for instantiations).

Cheers,
Jonathan

@falcaopetri
Copy link
Contributor Author

Thanks for the clarification. It makes total sense for the AMIE use case.

I agree with the low priority. I found this behavior when trying to check subsumption with areEquivalent. Nonetheless, I managed to fulfill my requirements by combining it with some pre-processing (I also didn't need full subsumption).

Regards,
Antonio.

@falcaopetri
Copy link
Contributor Author

Hi,

I just found that there is a Rule.subsumes method. Again, it is a "special case" of subsumption.

It "fails" in implementing subsumption for R.subsumes(R), because of

https://github.com/lajus/amie/blob/a2beeca2969202602d48f421ba682acc99a02ac2/rules/src/main/java/amie/rules/Rule.java#L2361

And "fails" for the reasons we discussed before. Besides depending on EquivalenceChecker, the check for Rule.areEquivalent does not bind variables to constants.

Regards,
Antonio.

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