Skip to content

Commit

Permalink
Improve test readability
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamtriggs committed Jan 29, 2020
1 parent b4e0d6d commit 6e2c170
Showing 1 changed file with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public void testUnionWithOptional() {
}

@Test
public void testUnionRestriction() {
public void testOptionalWithUnionRestriction() {
// It was possible to pass all other tests, but still generate incorrect algebra
// when a query contained an OPTIONAL pattern, and was also retricted by a UNION of patterns
// This test ensures this specific edge case is validated
testTransform(
// SPARQL to Test
"CONSTRUCT {\n" +
Expand All @@ -190,31 +193,24 @@ public void testUnionRestriction() {
"} WHERE {\n" +
" ?publication a ?type .\n" +
" OPTIONAL { ?publication <http://localhost/access> ?access . }\n" +
" ?publication <http://localhost/dateTimeValue> ?dateTimeObj .\n" +
" ?dateTimeObj <http://localhost/dateTime> ?dateTime .\n" +
" {\n" +
"\t\t ?publication a <http://localhost/Report> .\n" +
"\t }\n" +
"\t UNION\n" +
"\t {\n" +
"\t\t ?publication a <http://localhost/AcademicArticle> .\n" +
"\t }\n" +
" {\n" +
" ?publication a <http://localhost/Report> .\n" +
" }\n" +
" UNION\n" +
" {\n" +
" ?publication a <http://localhost/AcademicArticle> .\n" +
" }\n" +
"}\n",

// Target Op
"(join\n" +
" (join\n" +
" (leftjoin\n" +
" (bgp\n" +
" (triple ?publication <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type)\n" +
" )\n" +
" (bgp\n" +
" (triple ?publication <http://localhost/access> ?access)\n" +
" ))\n" +
" (bgp\n" +
" (triple ?publication <http://localhost/dateTimeValue> ?dateTimeObj)\n" +
" (triple ?dateTimeObj <http://localhost/dateTime> ?dateTime)\n" +
" ))\n" +
" (union\n" +
" (bgp (triple ?publication <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://localhost/Report>))\n" +
" (bgp (triple ?publication <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://localhost/AcademicArticle>))\n" +
Expand Down

0 comments on commit 6e2c170

Please sign in to comment.