afs commented on code in PR #1689:
URL: https://github.com/apache/jena/pull/1689#discussion_r1053103859


##########
jena-extras/jena-serviceenhancer/src/test/java/org/apache/jena/sparql/service/enhancer/impl/TestServiceEnhancerMisc.java:
##########
@@ -462,4 +470,55 @@ public void testNormalization01() {
         int actualRowCount = 
AbstractTestServiceEnhancerResultSetLimits.testWithCleanCaches(dataset, 
queryStr, 1000);
         Assert.assertEquals(4, actualRowCount);
     }
+
+    /**
+     * Test for <a 
href="https://github.com/apache/jena/issues/1688";>/issues/1688</a>.
+     * <p>
+     * This test checks that building an overall result set from a bulk request
+     * that involves contributions of cached empty result sets works as 
expected.
+     * Without the fix corresponding to this issues this test fails.
+     *
+     * @implNote This test case makes use of a dataset where only a few 
resources have labels.
+     * The test query caches the labels of all resources which means that most 
cache entries
+     * have empty results.
+     */
+    @Test
+    public void testBulkRequestsOverCachedEmptyResultSets() {
+        String dataStr = 
String.join(StandardSystemProperty.LINE_SEPARATOR.value(),
+            "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>",
+            "<urn:example:00> a rdfs:Resource .",
+            "<urn:example:01> a rdfs:Resource .",
+            "<urn:example:02> a rdfs:Resource .",
+            "<urn:example:03> a rdfs:Resource .",
+            "<urn:example:04> a rdfs:Resource ; rdfs:label '04' .",
+            "<urn:example:05> a rdfs:Resource .",
+            "<urn:example:06> a rdfs:Resource .",
+            "<urn:example:07> a rdfs:Resource .",
+            "<urn:example:08> a rdfs:Resource ; rdfs:label '08' .",
+            "<urn:example:09> a rdfs:Resource ; rdfs:label '09' .");
+
+        String queryStr = 
String.join(StandardSystemProperty.LINE_SEPARATOR.value(),
+            "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>",
+            "SELECT * {",
+            "  { SELECT * { ?s a rdfs:Resource } ORDER BY ?s }",
+            "   SERVICE <loop:cache:bulk+5> { ?s rdfs:label ?l }",
+            "}");
+
+        Dataset ds = DatasetFactory.create();
+        RDFDataMgr.read(ds, new StringReader(dataStr), null, Lang.TURTLE);

Review Comment:
   FYI:
   `RDFParser.fromString(dataStr).lang(Lang.TURTLE).toDataset();`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to