Skip to content

Commit

Permalink
Test for #334
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-asprino committed Feb 6, 2023
1 parent 081a9c1 commit 85da2b1
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -629,5 +629,34 @@ public void testIssue295() throws URISyntaxException, IOException {
}


/**
* See https://github.com/SPARQL-Anything/sparql.anything/issues/292
*
* @throws URISyntaxException
* @throws IOException
*/
@Test
public void testIssue334() throws URISyntaxException, IOException {
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything", "Trace");
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything.model.HTTPHelper", "ERROR");
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything.engine.TriplifierRegister", "ERROR");
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything.engine.FacadeX", "ERROR");
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything.facadeiri", "ERROR");
Dataset ds = DatasetFactory.createGeneral();
QC.setFactory(ARQ.getContext(), FacadeX.ExecutorFactory);
Query query;
String queryStr = IOUtils.toString(getClass().getClassLoader().getResource("issues/issue334.sparql").toURI(),
StandardCharsets.UTF_8);
String location = getClass().getClassLoader().getResource("issues/issue334.tar").toURI().toString();
queryStr = queryStr.replace("%%%LOCATION%%%", location);

query = QueryFactory.create(queryStr);

QueryExecution qExec = QueryExecutionFactory.create(query, ds);

qExec.execConstruct().write(System.out, "TTL");
}



}
32 changes: 32 additions & 0 deletions sparql-anything-it/src/test/resources/issues/issue334.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# rdfize an archive (zip) of files.
# parameter values:
# -v zip: zip filename or URL
# -v file: file regexp pattern (default ~.*~)
# sparql-anything -q ../rdfize-zip.sparql -v zip=graphql-2023-01-24.zip > raw-rdf.ttl
# See https://sparql-anything.readthedocs.io/en/latest/Configuration/#from-archive

prefix bsdd: <http://bsdd.buildingsmart.org/def#>
prefix xyz: <http://sparql.xyz/facade-x/data/>
prefix fx: <http://sparql.xyz/facade-x/ns/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

construct {
?s ?p ?o
} where {
service <x-sparql-anything:> {
bind(coalesce(?__file,".*") as ?pattern)
fx:properties fx:location "%%%LOCATION%%%" .
fx:properties fx:archive.matches ?pattern.
[] fx:anySlot ?file
service <x-sparql-anything:media-type=application/json> {
bind(str(bsdd:) as ?bsdd)
fx:properties fx:namespace ?bsdd.
fx:properties fx:location ?file.
fx:properties fx:from-archive "%%%LOCATION%%%".
fx:properties fx:use-rdfs-member true.
?s ?p ?o
}
}
}
Binary file not shown.

0 comments on commit 85da2b1

Please sign in to comment.