Skip to content

Commit

Permalink
Revert "Better support for Unicode paths (#1123)" (#1126)
Browse files Browse the repository at this point in the history
This reverts commit a2f5b48.
  • Loading branch information
acoburn authored Oct 28, 2020
1 parent 6feb82b commit 44dbbd2
Showing 1 changed file with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
import org.apache.jena.sparql.core.DatasetGraph;
import org.apache.jena.sparql.core.DatasetGraphFactory;
import org.apache.jena.update.UpdateException;
import org.apache.jena.util.URIref;
import org.eclipse.microprofile.config.Config;
import org.slf4j.Logger;
import org.trellisldp.api.CacheService;
Expand Down Expand Up @@ -235,7 +234,7 @@ public void write(final Stream<Triple> triples, final OutputStream output, final

try {
if (RDFA.equals(syntax)) {
writeHTML(triples, output, encodeURI(baseUrl));
writeHTML(triples, output, baseUrl);
} else {
final Lang lang = JenaCommonsRDF.toJena(syntax).orElseThrow(() ->
new TrellisRuntimeException("Invalid content type: " + syntax.mediaType()));
Expand All @@ -248,7 +247,7 @@ public void write(final Stream<Triple> triples, final OutputStream output, final
stream.start();
nsService.getNamespaces().forEach(stream::prefix);
if (shouldUseRelativeIRIs(relativeIRIs, profiles)) {
stream.base(encodeURI(baseUrl));
stream.base(baseUrl);
}
triples.map(JenaCommonsRDF::toJena).forEachOrdered(stream::triple);
stream.finish();
Expand Down Expand Up @@ -330,7 +329,7 @@ public Stream<Triple> read(final InputStream input, final RDFSyntax syntax, fina
final Lang lang = JenaCommonsRDF.toJena(syntax).orElseThrow(() ->
new TrellisRuntimeException("Unsupported RDF Syntax: " + syntax.mediaType()));

RDFParser.source(input).lang(lang).base(encodeURI(base)).parse(graph);
RDFParser.source(input).lang(lang).base(base).parse(graph);

// Check the graph for any new namespace definitions
final Set<String> namespaces = new HashSet<>(nsService.getNamespaces().values());
Expand All @@ -357,19 +356,12 @@ public void update(final Graph graph, final String update, final RDFSyntax synta

try {
final org.apache.jena.graph.Graph g = JenaCommonsRDF.toJena(graph);
execute(create(update, encodeURI(base)), g);
execute(create(update, base), g);
} catch (final UpdateException | QueryParseException ex) {
throw new TrellisRuntimeException(ex);
}
}

static String encodeURI(final String uri) {
if (uri != null) {
return URIref.encode(uri);
}
return uri;
}

static Set<String> intoSet(final String property) {
return stream(property.split(",")).map(String::trim).filter(x -> !x.isEmpty()).collect(toSet());
}
Expand Down

0 comments on commit 44dbbd2

Please sign in to comment.