Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
luigi-asprino committed Nov 20, 2024
1 parent 5115c33 commit 5c42c1f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -968,6 +968,14 @@ public void testIssue429() throws URISyntaxException, IOException {
// assertFalse(rs.hasNext());
}

@Test
public void testIssue515() throws URISyntaxException, IOException {
QueryExecution qExec = executeTest("issues/issue515.sparql", "issues/issue515.something", false, false, false, false);
ResultSet rs = qExec.execSelect();
assertTrue(rs.hasNext());
}


private QueryExecution executeTest(String queryPath, String resourcePath, boolean printQueryString, boolean printFormattedQuery, boolean printResults, boolean constructResource) throws IOException, URISyntaxException {
Dataset ds = DatasetFactory.createGeneral();
QC.setFactory(ARQ.getContext(), FacadeX.ExecutorFactory);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<a> <b> <c> .
15 changes: 15 additions & 0 deletions sparql-anything-it/src/test/resources/issues/issue515.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREFIX fx: <http://sparql.xyz/facade-x/ns/>
PREFIX xyz: <http://sparql.xyz/facade-x/data/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT *
WHERE {
{
SERVICE <x-sparql-anything:> {
fx:properties fx:media-type "text/turtle" ;
fx:location "%%%LOCATION%%%" .
?s ?p ?o .
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@

package io.github.sparqlanything.rdf;

import io.github.sparqlanything.model.FacadeXGraphBuilder;
import io.github.sparqlanything.model.HTTPHelper;
import io.github.sparqlanything.model.Triplifier;
import io.github.sparqlanything.model.TriplifierHTTPException;
import io.github.sparqlanything.model.*;
import org.apache.commons.io.IOUtils;
import org.apache.http.Header;
import org.apache.http.client.methods.CloseableHttpResponse;
Expand All @@ -44,7 +41,7 @@ public class RDFTriplifier implements Triplifier {

// private static Logger logger = LoggerFactory.getLogger(RDFTriplifier.class);

public static Lang getRDFLang(Properties properties, String url, Header contentType) {
private static Lang getRDFLang(Properties properties, String url, Header contentType) {
Lang lang = null;

// Version from HTTP content type response
Expand All @@ -60,6 +57,9 @@ public static Lang getRDFLang(Properties properties, String url, Header contentT
if (lang == null && properties.containsKey(HTTPHelper.HTTPHEADER_PREFIX + "accept")) {
lang = RDFLanguages.contentTypeToLang(properties.getProperty(HTTPHelper.HTTPHEADER_PREFIX + "accept"));
}
if (lang == null && properties.containsKey(IRIArgument.MEDIA_TYPE.toString())) {
lang = RDFLanguages.contentTypeToLang(PropertyUtils.getStringProperty(properties, IRIArgument.MEDIA_TYPE));
}
if (lang == null) {
// Version from location file extension
lang = RDFLanguages.filenameToLang(url);
Expand All @@ -72,7 +72,7 @@ public static Lang getRDFLang(Properties properties, String url, Header contentT
// However, the JSON is not a proper LANG, therefore, we rewrite it here
// See #356
// See io.github.sparqlanything.cli.SPARQLAnything.initSPARQLAnythingEngine()
if(lang.getLabel().equals("JSON")){
if(lang!=null && lang.getLabel().equals("JSON")){
lang = Lang.JSONLD;
}
log.trace("Lang {}", lang);
Expand Down

0 comments on commit 5c42c1f

Please sign in to comment.