Skip to content

Commit

Permalink
apacheGH-2936: Use IRI3986 in the Fuseki IRIValidator
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Jan 11, 2025
1 parent a60c984 commit b71db85
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import jakarta.servlet.ServletOutputStream;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.apache.jena.iri3986.provider.IRIProvider3986;
import org.apache.jena.irix.IRIException;
import org.apache.jena.irix.IRIProvider;
import org.apache.jena.irix.IRIx;

public class IRIValidatorHTML
Expand Down Expand Up @@ -60,6 +62,8 @@ public static void executeHTML(HttpServletRequest httpRequest, HttpServletRespon

try {
boolean first = true;
IRIProvider provider = new IRIProvider3986();

for ( String iriStr : args ) {
if ( iriStr.startsWith("<") ) {
iriStr = iriStr.substring(1);
Expand All @@ -70,7 +74,7 @@ public static void executeHTML(HttpServletRequest httpRequest, HttpServletRespon
System.out.println();
first = false;
try {
IRIx iri = IRIx.create(iriStr);
IRIx iri = provider.create(iriStr);
System.out.println(iriStr + " ==> " + iri);
if ( iri.isRelative() )
System.out.println("Relative IRI: " + iriStr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
import org.apache.jena.atlas.json.JsonBuilder;
import org.apache.jena.atlas.json.JsonObject;
import org.apache.jena.fuseki.servlets.ServletOps;
import org.apache.jena.iri3986.provider.IRIProvider3986;
import org.apache.jena.irix.IRIException;
import org.apache.jena.irix.IRIProvider;
import org.apache.jena.irix.IRIx;

public class IRIValidatorJSON {
Expand All @@ -55,13 +57,15 @@ public static JsonObject execute(ValidationAction action) {
obj.key(jIRIs);
obj.startArray();

IRIProvider provider = new IRIProvider3986();

for ( String iriStr : args ) {
obj.startObject();
obj.key(jIRI).value(iriStr);
List<String> errors = new ArrayList<>();
List<String> warnings = new ArrayList<>();
try {
IRIx iri = IRIx.create(iriStr);
IRIx iri = provider.create(iriStr);
System.out.println(iriStr + " ==> " + iri);
if ( iri.isRelative() )
if ( iri.isRelative() )
Expand Down

0 comments on commit b71db85

Please sign in to comment.