74
74
import org .apache .jena .sparql .core .DatasetGraph ;
75
75
import org .apache .jena .sparql .core .DatasetGraphFactory ;
76
76
import org .apache .jena .update .UpdateException ;
77
- import org .apache .jena .util .URIref ;
78
77
import org .eclipse .microprofile .config .Config ;
79
78
import org .slf4j .Logger ;
80
79
import org .trellisldp .api .CacheService ;
@@ -235,7 +234,7 @@ public void write(final Stream<Triple> triples, final OutputStream output, final
235
234
236
235
try {
237
236
if (RDFA .equals (syntax )) {
238
- writeHTML (triples , output , encodeURI ( baseUrl ) );
237
+ writeHTML (triples , output , baseUrl );
239
238
} else {
240
239
final Lang lang = JenaCommonsRDF .toJena (syntax ).orElseThrow (() ->
241
240
new TrellisRuntimeException ("Invalid content type: " + syntax .mediaType ()));
@@ -248,7 +247,7 @@ public void write(final Stream<Triple> triples, final OutputStream output, final
248
247
stream .start ();
249
248
nsService .getNamespaces ().forEach (stream ::prefix );
250
249
if (shouldUseRelativeIRIs (relativeIRIs , profiles )) {
251
- stream .base (encodeURI ( baseUrl ) );
250
+ stream .base (baseUrl );
252
251
}
253
252
triples .map (JenaCommonsRDF ::toJena ).forEachOrdered (stream ::triple );
254
253
stream .finish ();
@@ -330,7 +329,7 @@ public Stream<Triple> read(final InputStream input, final RDFSyntax syntax, fina
330
329
final Lang lang = JenaCommonsRDF .toJena (syntax ).orElseThrow (() ->
331
330
new TrellisRuntimeException ("Unsupported RDF Syntax: " + syntax .mediaType ()));
332
331
333
- RDFParser .source (input ).lang (lang ).base (encodeURI ( base ) ).parse (graph );
332
+ RDFParser .source (input ).lang (lang ).base (base ).parse (graph );
334
333
335
334
// Check the graph for any new namespace definitions
336
335
final Set <String > namespaces = new HashSet <>(nsService .getNamespaces ().values ());
@@ -357,19 +356,12 @@ public void update(final Graph graph, final String update, final RDFSyntax synta
357
356
358
357
try {
359
358
final org .apache .jena .graph .Graph g = JenaCommonsRDF .toJena (graph );
360
- execute (create (update , encodeURI ( base ) ), g );
359
+ execute (create (update , base ), g );
361
360
} catch (final UpdateException | QueryParseException ex ) {
362
361
throw new TrellisRuntimeException (ex );
363
362
}
364
363
}
365
364
366
- static String encodeURI (final String uri ) {
367
- if (uri != null ) {
368
- return URIref .encode (uri );
369
- }
370
- return uri ;
371
- }
372
-
373
365
static Set <String > intoSet (final String property ) {
374
366
return stream (property .split ("," )).map (String ::trim ).filter (x -> !x .isEmpty ()).collect (toSet ());
375
367
}
0 commit comments