[Mulgara-svn] r1435 - trunk/src/jar/query/java/org/mulgara/query/filter
alexhall at mulgara.org
alexhall at mulgara.org
Fri Jan 16 18:43:48 UTC 2009
Author: alexhall
Date: 2009-01-16 10:43:46 -0800 (Fri, 16 Jan 2009)
New Revision: 1435
Modified:
trunk/src/jar/query/java/org/mulgara/query/filter/Or.java
trunk/src/jar/query/java/org/mulgara/query/filter/OrUnitTest.java
Log:
Fixed a logic error that affected handling of type errors with SPARQL logical-or filters.
Modified: trunk/src/jar/query/java/org/mulgara/query/filter/Or.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/filter/Or.java 2009-01-14 02:49:33 UTC (rev 1434)
+++ trunk/src/jar/query/java/org/mulgara/query/filter/Or.java 2009-01-16 18:43:46 UTC (rev 1435)
@@ -52,7 +52,7 @@
result = filters.get(0).test(context);
} catch (QueryException e) {
// true on the RHS gives true
- if (!testList(context, tail(filters))) return true;
+ if (testList(context, tail(filters))) return true;
throw e;
}
return result || testList(context, tail(filters));
Modified: trunk/src/jar/query/java/org/mulgara/query/filter/OrUnitTest.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/filter/OrUnitTest.java 2009-01-14 02:49:33 UTC (rev 1434)
+++ trunk/src/jar/query/java/org/mulgara/query/filter/OrUnitTest.java 2009-01-16 18:43:46 UTC (rev 1435)
@@ -108,7 +108,9 @@
new Node[] {falseLiteral, new BlankNodeImpl(1001)},
new Node[] {trueLiteral, new BlankNodeImpl(1002)},
new Node[] {falseLiteral, null},
- new Node[] {trueLiteral, null}
+ new Node[] {trueLiteral, null},
+ new Node[] {null, falseLiteral},
+ new Node[] {null, trueLiteral}
};
TestContext c = new TestContext(new String[] {"x", "y"}, rows);
c.beforeFirst();
@@ -179,6 +181,15 @@
assertTrue(c.next());
assertTrue(t.equals(fn));
+ assertTrue(c.next());
+ try {
+ fn.getValue();
+ fail("Logic operation on an unbound");
+ } catch (QueryException qe) { }
+
+ assertTrue(c.next());
+ assertTrue(t.equals(fn));
+
assertFalse(c.next());
}
More information about the Mulgara-svn
mailing list