Skip to content

Commit

Permalink
Fix #316 -- may be also relevant for #266
Browse files Browse the repository at this point in the history
  • Loading branch information
enridaga committed Oct 24, 2022
1 parent 9901e37 commit 9fdc5e3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.riot.RDFDataMgr;
import org.apache.jena.sparql.engine.main.QC;
import org.apache.jena.tdb.TDB;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
Expand Down Expand Up @@ -417,16 +418,22 @@ public void testIssue280() throws URISyntaxException, IOException {
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything.facadeiri", "ERROR");

String location = getClass().getClassLoader().getResource("issues/issue280.json").toURI().toString();

File TDBfile = new File("target/tdbIssue280/" );
if(TDBfile.exists()){
TDBfile.delete();
}
TDBfile.mkdirs();
String TDBLocation = TDBfile.getAbsolutePath().toString();
log.debug("TDB temp location: {}", TDBLocation);
Query qs = QueryFactory.create(
"PREFIX fx: <http://sparql.xyz/facade-x/ns/> " +
"PREFIX xyz: <http://sparql.xyz/facade-x/data/> " +
"SELECT * WHERE { " +
"SERVICE <x-sparql-anything:location=" + location + ",ondisk=/tmp> { " +
"SERVICE <x-sparql-anything:location=" + location + ",ondisk=" + TDBLocation + "> { " +
" ?s xyz:name ?o } }");

// System.out.println(location);
// System.out.println(qs.toString(Syntax.defaultSyntax));
System.out.println(qs.toString(Syntax.defaultSyntax));
Dataset ds = DatasetFactory.createGeneral();
QC.setFactory(ARQ.getContext(), FacadeX.ExecutorFactory);

Expand All @@ -443,7 +450,7 @@ public void testIssue280() throws URISyntaxException, IOException {


qs = QueryFactory.create(
"PREFIX fx: <http://sparql.xyz/facade-x/ns/> PREFIX xyz: <http://sparql.xyz/facade-x/data/> SELECT * WHERE { SERVICE <x-sparql-anything:> { fx:properties fx:location \"" + location + "\" ; fx:ondisk \"/tmp\" . " +
"PREFIX fx: <http://sparql.xyz/facade-x/ns/> PREFIX xyz: <http://sparql.xyz/facade-x/data/> SELECT * WHERE { SERVICE <x-sparql-anything:> { fx:properties fx:location \"" + location + "\" ; fx:ondisk \"" + TDBLocation + "\" . " +
" ?s xyz:name ?o } }");


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
import org.apache.jena.sparql.engine.main.QC;
import org.junit.Ignore;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.HashSet;
Expand All @@ -40,7 +43,7 @@
import static org.junit.Assert.assertTrue;

public class IssuesTest2 {

private static final Logger log = LoggerFactory.getLogger(IssuesTest2.class);
/**
* See https://github.com/SPARQL-Anything/sparql.anything/issues/280
*
Expand All @@ -56,12 +59,18 @@ public void testIssue280() throws URISyntaxException, IOException {
// System.setProperty("org.slf4j.simpleLogger.log.com.github.sparqlanything.facadeiri", "ERROR");

String location = getClass().getClassLoader().getResource("issues/issue280.json").toURI().toString();

File TDBfile = new File("target/tdbIssue280/" );
if(TDBfile.exists()){
TDBfile.delete();
}
TDBfile.mkdirs();
String TDBLocation = TDBfile.getAbsolutePath().toString();
log.debug("TDB temp location: {}", TDBLocation);
Query qs = QueryFactory.create(
"PREFIX fx: <http://sparql.xyz/facade-x/ns/> " +
"PREFIX xyz: <http://sparql.xyz/facade-x/data/> " +
"SELECT * WHERE { " +
"SERVICE <x-sparql-anything:location=" + location + ",ondisk=/tmp> { " +
"SERVICE <x-sparql-anything:location=" + location + ",ondisk=" + TDBLocation + "> { " +
" ?s xyz:name ?o } }");

// System.out.println(location);
Expand All @@ -82,7 +91,7 @@ public void testIssue280() throws URISyntaxException, IOException {


qs = QueryFactory.create(
"PREFIX fx: <http://sparql.xyz/facade-x/ns/> PREFIX xyz: <http://sparql.xyz/facade-x/data/> SELECT * WHERE { SERVICE <x-sparql-anything:> { fx:properties fx:location \"" + location + "\" ; fx:ondisk \"/tmp\" . " +
"PREFIX fx: <http://sparql.xyz/facade-x/ns/> PREFIX xyz: <http://sparql.xyz/facade-x/data/> SELECT * WHERE { SERVICE <x-sparql-anything:> { fx:properties fx:location \"" + location + "\" ; fx:ondisk \"" + TDBLocation + "\" . " +
" ?s xyz:name ?o } }");


Expand Down

0 comments on commit 9fdc5e3

Please sign in to comment.