Skip to content

Commit

Permalink
Fix #421
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-asprino committed Nov 13, 2023
1 parent 75f63fd commit 37687bf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public FacadeXOpExecutor(ExecutionContext execCxt) {

protected QueryIterator execute(final OpPropFunc opPropFunc, QueryIterator input){
logger.trace("OpProp {}", opPropFunc);
if (this.execCxt.getClass() == FacadeXExecutionContext.class) {

if(!Utils.isFacadeXMagicPropertyNode(opPropFunc.getProperty())||this.execCxt.getClass() == FacadeXExecutionContext.class){
return super.execute(opPropFunc, input);
}else {
try {
Expand All @@ -82,7 +81,7 @@ protected QueryIterator execute(final OpBGP opBGP, QueryIterator input) {
throw new RuntimeException(e);
}
}

// check that the BGP is within a FacadeX-SERVICE clause
if (this.execCxt.getClass() == FacadeXExecutionContext.class) {
// check that the BGP contains FacadeX Magic properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,28 @@ public void testIssue371() throws URISyntaxException, IOException {
// Assert.assertFalse(m1.isIsomorphicWith(m2));

// Assert.assertTrue(qExec.execSelect().hasNext());
}


@Test
public void testIssue421() throws URISyntaxException, IOException {
Dataset ds = DatasetFactory.createGeneral();
QC.setFactory(ARQ.getContext(), FacadeX.ExecutorFactory);
Query query;
String queryStr = IOUtils.toString(Objects.requireNonNull(getClass().getClassLoader().getResource("issues/issue421.sparql")).toURI(), StandardCharsets.UTF_8);
query = QueryFactory.create(queryStr);

// System.out.println(Algebra.compile(query));
// System.out.println(query.toString(Syntax.defaultSyntax));

QueryExecution qExec1 = QueryExecutionFactory.create(query, ds);
// System.out.println(ResultSetFormatter.asText(qExec1.execSelect()));
Set<String> result = new HashSet<>();
ResultSet rs = qExec1.execSelect();
while (rs.hasNext()){
result.add(rs.next().get("a").asLiteral().toString());
}
assertEquals(Sets.newHashSet("abc", "cde"), result);

}

Expand Down
12 changes: 12 additions & 0 deletions sparql-anything-it/src/test/resources/issues/issue421.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PREFIX fx: <http://sparql.xyz/facade-x/ns/>
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX apf: <http://jena.apache.org/ARQ/property#>
SELECT ?a WHERE {
SERVICE <x-sparql-anything:> {
fx:properties fx:content "abc;cde" .
?s rdf:_1 ?o
}
?a apf:strSplit(?o ";") .
}

0 comments on commit 37687bf

Please sign in to comment.