diff --git a/core/http/client/src/main/java/org/eclipse/rdf4j/http/client/shacl/RemoteValidation.java b/core/http/client/src/main/java/org/eclipse/rdf4j/http/client/shacl/RemoteValidation.java index 75968f4a9be..54e95d4624b 100644 --- a/core/http/client/src/main/java/org/eclipse/rdf4j/http/client/shacl/RemoteValidation.java +++ b/core/http/client/src/main/java/org/eclipse/rdf4j/http/client/shacl/RemoteValidation.java @@ -16,8 +16,12 @@ import org.eclipse.rdf4j.common.annotation.InternalUseOnly; import org.eclipse.rdf4j.model.Model; +import org.eclipse.rdf4j.model.impl.SimpleValueFactory; +import org.eclipse.rdf4j.rio.ParserConfig; import org.eclipse.rdf4j.rio.RDFFormat; import org.eclipse.rdf4j.rio.Rio; +import org.eclipse.rdf4j.rio.helpers.BasicParserSettings; +import org.eclipse.rdf4j.rio.helpers.ParseErrorLogger; @InternalUseOnly class RemoteValidation { @@ -37,7 +41,9 @@ class RemoteValidation { Model asModel() { if (model == null) { try { - model = Rio.parse(stringReader, baseUri, format); + ParserConfig parserConfig = new ParserConfig().set(BasicParserSettings.PRESERVE_BNODE_IDS, true); + model = Rio.parse(stringReader, baseUri, format, parserConfig, SimpleValueFactory.getInstance(), + new ParseErrorLogger()); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/tools/server-spring/src/main/java/org/eclipse/rdf4j/http/server/ProtocolExceptionResolver.java b/tools/server-spring/src/main/java/org/eclipse/rdf4j/http/server/ProtocolExceptionResolver.java index 6163ad51a7b..4edb356141e 100644 --- a/tools/server-spring/src/main/java/org/eclipse/rdf4j/http/server/ProtocolExceptionResolver.java +++ b/tools/server-spring/src/main/java/org/eclipse/rdf4j/http/server/ProtocolExceptionResolver.java @@ -78,15 +78,14 @@ public ModelAndView resolveException(HttpServletRequest request, HttpServletResp StringWriter stringWriter = new StringWriter(); - // We choose NQUADS because we want to support streaming in the future, and because there could be a use for - // different graphs in the future - Rio.write(validationReportModel, stringWriter, RDFFormat.NQUADS); + // We choose RDFJSON because this format doesn't rename blank nodes. + Rio.write(validationReportModel, stringWriter, RDFFormat.RDFJSON); statusCode = HttpServletResponse.SC_CONFLICT; errMsg = stringWriter.toString(); Map headers = new HashMap<>(); - headers.put("Content-Type", "application/shacl-validation-report+n-quads"); + headers.put("Content-Type", "application/shacl-validation-report+rdf+json"); model.put(SimpleResponseView.CUSTOM_HEADERS_KEY, headers); }