From da6b84225f391a0690d16d8b8c53e9489c75f4b6 Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Tue, 5 Jan 2021 09:38:51 +0000 Subject: Attempt to force a better ordering of body atoms in filtering rules This is based on an email from Yavor, suggesting a couple of improvements on the code. In particular this refers to the fact that, when RDFox lacks any information it assumes user ordering in the processing order of a rule body. --- .../scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/main/scala/uk/ac') diff --git a/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala b/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala index 4e533c6..9427735 100644 --- a/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala +++ b/src/main/scala/uk/ac/ox/cs/rsacomb/FilteringProgram.scala @@ -126,9 +126,9 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) { if index2 >= 0 } yield Rule.create( RSA.FK, + RSA.ID(RSA(index1), RSA(index2)), role1 << Forward, role2 << Forward, - RSA.ID(RSA(index1), RSA(index2)), not(RSA.Congruent(role1.getArguments get 0, role2.getArguments get 0)) ) val r4b = for { @@ -140,9 +140,9 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) { if index2 >= 0 } yield Rule.create( RSA.FK, + RSA.ID(RSA(index1), RSA(index2)), role1 << Forward, role2 << Backward, - RSA.ID(RSA(index1), RSA(index2)), not(RSA.Congruent(role1.getArguments get 0, role2.getArguments get 2)) ) val r4c = for { @@ -154,9 +154,9 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) { if index2 >= 0 } yield Rule.create( RSA.FK, + RSA.ID(RSA(index1), RSA(index2)), role1 << Backward, role2 << Backward, - RSA.ID(RSA(index1), RSA(index2)), not(RSA.Congruent(role1.getArguments get 2, role2.getArguments get 2)) ) @@ -180,13 +180,13 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) { RSA(query.bounded indexOf r1arg0), RSA(query.bounded indexOf r2arg0) ), - role1 << Forward, - role2 << Forward, RSA.ID( RSA(query.bounded indexOf r1arg2), RSA(query.bounded indexOf r2arg2) ), RSA.Congruent(r1arg0, r2arg0), + role1 << Forward, + role2 << Forward, not(RSA.NI(r1arg0)) ) val r5b = for { @@ -205,13 +205,13 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) { RSA(query.bounded indexOf r1arg0), RSA(query.bounded indexOf r2arg2) ), - role1 << Forward, - role2 << Backward, RSA.ID( RSA(query.bounded indexOf r1arg2), RSA(query.bounded indexOf r2arg0) ), RSA.Congruent(r1arg0, r2arg2), + role1 << Forward, + role2 << Backward, not(RSA.NI(r1arg0)) ) val r5c = for { @@ -230,13 +230,13 @@ class FilteringProgram(query: ConjunctiveQuery, constants: List[Term]) { RSA(query.bounded indexOf r1arg2), RSA(query.bounded indexOf r2arg2) ), - role1 << Backward, - role2 << Backward, RSA.ID( RSA(query.bounded indexOf r1arg0), RSA(query.bounded indexOf r2arg0) ), RSA.Congruent(r1arg2, r2arg2), + role1 << Backward, + role2 << Backward, not(RSA.NI(r1arg2)) ) -- cgit v1.2.3