diff --git a/sparql-anything-it/src/test/java/com/github/sparqlanything/it/Issues.java b/sparql-anything-it/src/test/java/com/github/sparqlanything/it/Issues.java index e9a7798d..a49191eb 100644 --- a/sparql-anything-it/src/test/java/com/github/sparqlanything/it/Issues.java +++ b/sparql-anything-it/src/test/java/com/github/sparqlanything/it/Issues.java @@ -43,6 +43,8 @@ import org.apache.jena.query.ResultSet; import org.apache.jena.query.ResultSetFormatter; import org.apache.jena.query.Syntax; +import org.apache.jena.rdf.model.Model; +import org.apache.jena.sparql.core.DatasetGraph; import org.apache.jena.sparql.engine.main.QC; import org.junit.Assert; import org.junit.Ignore; @@ -196,4 +198,23 @@ public void testIssue114() throws IOException, URISyntaxException { assertEquals(Sets.newHashSet("b", "d", "c"), slots); } + /** + * See https://github.com/SPARQL-Anything/sparql.anything/issues/154 + * + * @throws URISyntaxException + * @throws IOException + */ + @Ignore + @Test + public void testIssue154() throws URISyntaxException, IOException { + String queryStr = IOUtils.toString(getClass().getClassLoader().getResource("issues/e.sparql").toURI(), StandardCharsets.UTF_8); + String location = getClass().getClassLoader().getResource("issues/a00002-1036.xml").toURI().toString(); + Query query = QueryFactory.create(queryStr.replace("%%LOCATION%%", location)); + Dataset ds = DatasetFactory.createGeneral(); + QC.setFactory(ARQ.getContext(), FacadeX.ExecutorFactory); + // XXX This process never ends! + Model rs = QueryExecutionFactory.create(query, ds).execConstruct(); + rs.write(System.err, "TTL"); + } + } diff --git a/sparql-anything-it/src/test/resources/issues/a00002-1036.xml b/sparql-anything-it/src/test/resources/issues/a00002-1036.xml new file mode 100644 index 00000000..00037c2e --- /dev/null +++ b/sparql-anything-it/src/test/resources/issues/a00002-1036.xml @@ -0,0 +1,93 @@ + + A00002 + 1922 + + Robert Blake + 1762 + Male + 38 + + Presented by Mrs John Richmond 1992 + 213 + 1036 + Graphite on paper + + + + + + 273 + comforting + + + 544 + embracing + + + 2653 + recoiling + + + + 177 + actions: expressive + + + + + + 451 + figure + + + + 95 + adults + + + + + + 799 + group + + + + 97 + groups + + + + 91 + people + + + + + + + 2815 + fear + + + + 31 + emotions and human qualities + + + + 29 + emotions, concepts and ideas + + + + 1 + topicRoot + + + Two Drawings of Frightened Figures, Probably for 'The Approach of Doom' + mm + https://www.tate.org.uk/art/artworks/blake-two-drawings-of-frightened-figures-probably-for-the-approach-of-doom-a00002 + 311 + + \ No newline at end of file diff --git a/sparql-anything-it/src/test/resources/issues/e.sparql b/sparql-anything-it/src/test/resources/issues/e.sparql new file mode 100644 index 00000000..54e2f007 --- /dev/null +++ b/sparql-anything-it/src/test/resources/issues/e.sparql @@ -0,0 +1,24 @@ +PREFIX fx: +PREFIX xyz: +PREFIX rdf: +PREFIX tsub: +PREFIX schema: +PREFIX rdfs: + +CONSTRUCT { + ?artwork schema:about ?topic . + ?topic schema:name ?name . +} WHERE { + SERVICE { +# [ a xyz:children; fx:anySlot [a xyz:item; fx:anySlot [ a xyz:id; rdf:_1 ?topicId]; fx:anySlot [ a xyz:name; rdf:_1 ?name ] ] ] . +# [ a xyz:children; ?li1 [a xyz:item; ?li2 [ a xyz:id; ?li3 ?topicId]; ?li4 [ a xyz:name; ?li5 ?name ] ] ] . + [] a xyz:children; fx:anySlot [a xyz:item; fx:anySlot [ a xyz:id; fx:anySlot ?topicId]; fx:anySlot [ a xyz:name; fx:anySlot ?name ]] . +# [] a xyz:children; ?li1 [a xyz:item; ?li2 [ a xyz:id; ?li3 ?topicId]; ?li4 [ a xyz:name; ?li5 ?name ]] . + [] a xyz:url; fx:anySlot ?artworkUrl . + BIND(IRI(?artworkUrl) as ?artwork) . + BIND(IRI(CONCAT(STR(tsub:),STR(?topicId))) AS ?topic) . + FILTER (?topicId != xyz:id) . + FILTER (?name != xyz:name) . + FILTER (?artworkUrl != xyz:url) . + } +} \ No newline at end of file