You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2015/10/21 22:01:26 UTC
[1/5] jena git commit: JENA-1051: Clean IRIResolver.
Repository: jena
Updated Branches:
refs/heads/master 0fb84388c -> 2c3e8fe1b
JENA-1051: Clean IRIResolver.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/fbf46ba5
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/fbf46ba5
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/fbf46ba5
Branch: refs/heads/master
Commit: fbf46ba5a97c3aadbda12fe672a6996504dd42e7
Parents: 0fb8438
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Oct 21 19:19:52 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Oct 21 19:19:52 2015 +0100
----------------------------------------------------------------------
.../apache/jena/riot/system/IRIResolver.java | 180 +++++++++----------
1 file changed, 85 insertions(+), 95 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/fbf46ba5/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
index e7d18b9..3c6bc2a 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
@@ -29,45 +29,60 @@ import org.apache.jena.iri.IRIFactory ;
import org.apache.jena.iri.ViolationCodes ;
import org.apache.jena.riot.RiotException ;
-/** Package up IRI reolver functionality. */
-
+/** IRI handling */
public abstract class IRIResolver
{
- // static IRIFactory iriFactory = IRIFactory.jenaImplementation() ;
- // static IRIFactory iriFactory = IRIFactory.iriImplementation();
-
- /** The IRI checker setup - more than usual Jena but not full IRI. */
+ /** The IRI checker setup, focused on paring and languages.
+ * This is a clean version of jena-iri IRIFactory.iriImplementation(),
+ * modified to allow unregistered schemes and allow <file:relative> IRIs.
+ *
+ * @see IRIFactory
+ */
public static final IRIFactory iriFactory = new IRIFactory() ;
private static boolean showExceptions = true ;
static {
- // IRIFactory.iriImplementation() ...
+ // These two are from IRIFactory.iriImplementation() ...
iriFactory.useSpecificationIRI(true) ;
iriFactory.useSchemeSpecificRules("*", true) ;
// Allow relative references for file: URLs.
iriFactory.setSameSchemeRelativeReferences("file") ;
- iriFactory.setIsError(ViolationCodes.UNREGISTERED_IANA_SCHEME, false) ;
- iriFactory.setIsWarning(ViolationCodes.UNREGISTERED_IANA_SCHEME, false) ;
+ setErrorWarning(iriFactory, ViolationCodes.UNREGISTERED_IANA_SCHEME, false, false) ;
+ // XXX Default?
+ // TODO turn off?? (ignored in CheckerIRI.iriViolations anyway).
+ //set(iriFactory, ViolationCodes.LOWERCASE_PREFERRED, false, false) ;
+ //set(iriFactory, ViolationCodes.PERCENT_ENCODING_SHOULD_BE_UPPERCASE, false, false) ;
+ //set(iriFactory, ViolationCodes.SCHEME_PATTERN_MATCH_FAILED, false, false) ;
+
// iriFactory.shouldViolation(false,true);
- // ** Consider not applying NFC tests
+ // NFC tests are not well understood and these cause confusion.
//iriFactory.setIsError(ViolationCodes.NOT_NFC, false) ;
//iriFactory.setIsError(ViolationCodes.NOT_NFKC, false) ;
- // ** Consider not applying -- applies to various unicode blocks.
- // iriFactory.setIsError(ViolationCodes.COMPATIBILITY_CHARACTER, false) ;
+ // ** Applies to various unicode blocks.
+ // XXX Default?
+ // set(iriFactory, ViolationCodes.COMPATIBILITY_CHARACTER, false, false) ;
+ // XXX Default?
// Moderate it -- allow unwise chars and any scheme name.
- // iriFactory.setIsError(ViolationCodes.UNWISE_CHARACTER,false);
- // iriFactory.setIsWarning(ViolationCodes.UNWISE_CHARACTER,false);
-
- // iriFactory.setIsError(ViolationCodes.UNDEFINED_UNICODE_CHARACTER, false) ;
- // iriFactory.setIsError(ViolationCodes.UNASSIGNED_UNICODE_CHARACTER, false) ;
-
+ //set(iriFactory, ViolationCodes.UNWISE_CHARACTER, false, false) ;
+ //set(iriFactory, ViolationCodes.UNDEFINED_UNICODE_CHARACTER, false, false) ;
}
+ /** Set the error/warnign state of a violation code.
+ * @param factory IRIFactory
+ * @param code ViolationCodes constant
+ * @param isError Whether it is to be treated an error.
+ * @param isWarning Whether it is to be treated a warning.
+ */
+ private static void setErrorWarning(IRIFactory factory, int code, boolean isError, boolean isWarning) {
+ factory.setIsError(code, isError);
+ factory.setIsWarning(code, isWarning);
+ }
+
/** Check an IRI string (does not resolve it) */
public static boolean checkIRI(String iriStr) {
IRI iri = parseIRI(iriStr) ;
@@ -250,14 +265,35 @@ public abstract class IRIResolver
return iri.toString() ;
}
+ /**
+ * The base of this IRIResolver.
+ *
+ * @return String
+ */
protected abstract IRI getBaseIRI() ;
- /** Create a URI, resolving relative IRIs, and throw exception on bad a IRI */
- public abstract IRI resolve(String uriStr) ;
+ /**
+ * Resolve a relative URI against the base of this IRIResolver
+ * or normalize an absolute URI.
+ *
+ * @param uriStr
+ * @return the resolved IRI
+ * @throws RiotException
+ * If resulting URI would not be legal, absolute IRI
+ */
+ public IRI resolve(String uriStr) {
+ return exceptions(resolveSilent(uriStr)) ;
+ }
/**
- * Create a URI, resolving relative IRIs, but do not throw exception on bad
- * a IRI
+ * Create a URI, resolving relative IRIs,
+ * normalize an absolute URI,
+ * but do not throw exception on a bad IRI.
+ *
+ * @param uriStr
+ * @return the resolved IRI
+ * @throws RiotException
+ * If resulting URI would not be legal, absolute IRI
*/
public abstract IRI resolveSilent(String uriStr) ;
@@ -277,28 +313,6 @@ public abstract class IRIResolver
protected IRIResolver()
{}
-// /**
-// * Print violations - convenience.
-// *
-// * @param iri
-// * @return iri
-// */
-// static private IRI exceptions2(IRI iri) {
-// if (showExceptions && iri.hasViolation(false)) {
-// try {
-// IRI iri2 = cwd.create(iri) ;
-// Iterator<Violation> vIter = iri2.violations(true) ;
-// for (; vIter.hasNext();) {
-// Violation v = vIter.next() ;
-// System.err.println(v) ;
-// }
-// } catch (IRIException e) {
-// throw new RiotException(e) ;
-// }
-// }
-// return iri ;
-// }
-
/**
* Throw any exceptions resulting from IRI.
*
@@ -317,8 +331,8 @@ public abstract class IRIResolver
private static final int CacheSize = 1000 ;
/**
- * A resolver that does not resolve IRIs against base. Can generate relative
- * IRIs.
+ * A resolver that does not resolve IRIs against base.
+ * This can generate relative IRIs.
**/
static class IRIResolverNoOp extends IRIResolver
{
@@ -333,11 +347,6 @@ public abstract class IRIResolver
}
@Override
- public IRI resolve(String uriStr) {
- return exceptions(resolveSilent(uriStr)) ;
- }
-
- @Override
public IRI resolveSilent(final String uriStr) {
if ( resolvedIRIs == null )
return iriFactory.create(uriStr) ;
@@ -362,11 +371,9 @@ public abstract class IRIResolver
/**
* Construct an IRIResolver with base as the current working directory.
- *
*/
- public IRIResolverNormal()
- {
- this((String)null) ;
+ public IRIResolverNormal() {
+ this((String)null);
}
/**
@@ -374,65 +381,48 @@ public abstract class IRIResolver
* this is relative, it is relative against the current working
* directory.
*
- * @param baseS
+ * @param baseStr
* @throws RiotException
* If resulting base unparsable.
*/
- public IRIResolverNormal(String baseS)
- {
- if (baseS == null)
- base = chooseBaseURI() ;
+ public IRIResolverNormal(String baseStr) {
+ if ( baseStr == null )
+ base = chooseBaseURI();
else
- base = globalResolver.resolveSilent(baseS) ;
+ base = globalResolver.resolveSilent(baseStr);
}
- public IRIResolverNormal(IRI baseIRI)
- {
- if (baseIRI == null)
- baseIRI = chooseBaseURI() ;
- base = baseIRI ;
+ public IRIResolverNormal(IRI baseIRI) {
+ if ( baseIRI == null )
+ baseIRI = chooseBaseURI();
+ base = baseIRI;
}
- /**
- * The base of this IRIResolver.
- *
- * @return String
- */
@Override
public IRI getBaseIRI() {
return base ;
}
- /**
- * Resolve the relative URI against the base of this IRIResolver.
- *
- * @param relURI
- * @return the resolved IRI
- * @throws RiotException
- * If resulting URI would not be legal, absolute IRI
- */
@Override
- public IRI resolve(String relURI) {
- return exceptions(resolveSilent(relURI)) ;
+ public IRI resolveSilent(String uriStr) {
+ if ( resolvedIRIs == null )
+ return resolveSilentCache(uriStr) ;
+ else
+ return resolveSilentNoCache(uriStr) ;
+ }
+
+ private IRI resolveSilentNoCache(String uriStr) {
+ IRI x = IRIResolver.iriFactory.create(uriStr) ;
+ return base.create(x) ;
}
- /**
- * Resolve the relative URI against the base of this IRIResolver.
- *
- * @param relURI
- * @return the resolved IRI - not checked for violations.
- */
-
- @Override
- public IRI resolveSilent(final String relURI) {
- if ( resolvedIRIs == null )
- return iriFactory.create(relURI) ;
- IRI x = IRIResolver.iriFactory.create(relURI) ;
- Callable<IRI> filler = () -> base.create(x) ;
- return resolvedIRIs.getOrFill(relURI, filler) ;
+ private IRI resolveSilentCache(final String uriStr) {
+ Callable<IRI> filler = () -> resolveSilentNoCache(uriStr) ;
+ return resolvedIRIs.getOrFill(uriStr, filler) ;
}
}
+ /** Thread safe wrapper for an IRIResolver */
static class IRIResolverSync extends IRIResolver
{
private final IRIResolver other ;
[4/5] jena git commit: JENA-1051: RDF/XML maximum backwards
compatibility.
Posted by an...@apache.org.
JENA-1051: RDF/XML maximum backwards compatibility.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/e770f332
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/e770f332
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/e770f332
Branch: refs/heads/master
Commit: e770f3323d07da261d9813b25f778980dab6af82
Parents: d0c232d
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Oct 21 20:59:06 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Oct 21 20:59:06 2015 +0100
----------------------------------------------------------------------
.../src/main/java/org/apache/jena/rdfxml/xmlinput/ARPOptions.java | 1 +
.../src/main/java/org/apache/jena/rdfxml/xmlinput/JenaReader.java | 1 +
.../java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java | 1 +
.../java/org/apache/jena/shared/wg/TestInputStreamFactory.java | 2 +-
.../src/test/java/org/apache/jena/rdfxml/xmlinput/URITests.java | 1 +
5 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/e770f332/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/ARPOptions.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/ARPOptions.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/ARPOptions.java
index a61d2bc..cb5b3f1 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/ARPOptions.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/ARPOptions.java
@@ -67,6 +67,7 @@ public class ARPOptions implements ARPErrorNumbers {
private boolean embedding = false;
private int errorMode[] = defaultErrorMode.clone();
+ @SuppressWarnings("deprecation")
private static IRIFactory defaultIriFactory = IRIFactory.jenaImplementation() ;
private IRIFactory iriFactory = defaultIriFactory ;
http://git-wip-us.apache.org/repos/asf/jena/blob/e770f332/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/JenaReader.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/JenaReader.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/JenaReader.java
index 1995306..3f1c6f0 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/JenaReader.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmlinput/JenaReader.java
@@ -436,6 +436,7 @@ public class JenaReader implements RDFReader, ARPErrorNumbers {
* WARN_* ditto<br/>
* iri-rules (String), "Jena", "IRI", "strict", "lax"
*/
+ @SuppressWarnings("deprecation")
static Object processArpOptions(ARPOptions options, String str, Object v,
RDFErrorHandler eh) {
// ARPOptions options = arpf.getOptions();
http://git-wip-us.apache.org/repos/asf/jena/blob/e770f332/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java
index 3cd8078..26591f7 100644
--- a/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java
+++ b/jena-core/src/main/java/org/apache/jena/rdfxml/xmloutput/impl/BaseXMLWriter.java
@@ -489,6 +489,7 @@ abstract public class BaseXMLWriter implements RDFXMLWriterI {
jenaPrefixCount = 0;
}
+ @SuppressWarnings("deprecation")
static IRIFactory factory = IRIFactory.jenaImplementation();
http://git-wip-us.apache.org/repos/asf/jena/blob/e770f332/jena-core/src/main/java/org/apache/jena/shared/wg/TestInputStreamFactory.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/shared/wg/TestInputStreamFactory.java b/jena-core/src/main/java/org/apache/jena/shared/wg/TestInputStreamFactory.java
index d7dd105..0375eec 100644
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/TestInputStreamFactory.java
+++ b/jena-core/src/main/java/org/apache/jena/shared/wg/TestInputStreamFactory.java
@@ -36,7 +36,7 @@ import org.apache.jena.shared.JenaException ;
* 2: do not actually open until the first read
*/
public class TestInputStreamFactory {
-
+ @SuppressWarnings("deprecation")
final IRIFactory iriFactory = IRIFactory.jenaImplementation();
final private IRI base;
http://git-wip-us.apache.org/repos/asf/jena/blob/e770f332/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/URITests.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/URITests.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/URITests.java
index 29aff52..618e31c 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/URITests.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/URITests.java
@@ -51,6 +51,7 @@ public class URITests
super(s);
}
+ @SuppressWarnings("deprecation")
static IRIFactory factory = IRIFactory.jenaImplementation();
// static {
// factory.useSpecificationRDF(false);
[2/5] jena git commit: JENA-1051: Clean initialization of IRIResolver.
Posted by an...@apache.org.
JENA-1051: Clean initialization of IRIResolver.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/10625df1
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/10625df1
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/10625df1
Branch: refs/heads/master
Commit: 10625df1a5405d215350b43a4ff0c9b52e3983a8
Parents: fbf46ba
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Oct 21 20:45:25 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Oct 21 20:45:25 2015 +0100
----------------------------------------------------------------------
.../apache/jena/riot/system/IRIResolver.java | 69 +++++++++++++++-----
1 file changed, 53 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/10625df1/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
index 3c6bc2a..2ecb8d1 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
@@ -18,6 +18,7 @@
package org.apache.jena.riot.system ;
+import java.io.PrintStream ;
import java.util.concurrent.Callable ;
import org.apache.jena.atlas.lib.Cache ;
@@ -27,6 +28,7 @@ import org.apache.jena.iri.IRI ;
import org.apache.jena.iri.IRIException ;
import org.apache.jena.iri.IRIFactory ;
import org.apache.jena.iri.ViolationCodes ;
+import org.apache.jena.iri.impl.PatternCompiler ;
import org.apache.jena.riot.RiotException ;
/** IRI handling */
@@ -38,8 +40,10 @@ public abstract class IRIResolver
*
* @see IRIFactory
*/
- public static final IRIFactory iriFactory = new IRIFactory() ;
- private static boolean showExceptions = true ;
+ public static final IRIFactory iriFactory = new IRIFactory();
+ private static boolean showExceptions = true;
+
+ private static final boolean ShowResolverSetup = false;
static {
// These two are from IRIFactory.iriImplementation() ...
iriFactory.useSpecificationIRI(true) ;
@@ -48,30 +52,42 @@ public abstract class IRIResolver
// Allow relative references for file: URLs.
iriFactory.setSameSchemeRelativeReferences("file") ;
- setErrorWarning(iriFactory, ViolationCodes.UNREGISTERED_IANA_SCHEME, false, false) ;
+ // Convert "SHOULD" to warning (default is "error").
+ // iriFactory.shouldViolation(false,true);
- // XXX Default?
- // TODO turn off?? (ignored in CheckerIRI.iriViolations anyway).
- //set(iriFactory, ViolationCodes.LOWERCASE_PREFERRED, false, false) ;
- //set(iriFactory, ViolationCodes.PERCENT_ENCODING_SHOULD_BE_UPPERCASE, false, false) ;
- //set(iriFactory, ViolationCodes.SCHEME_PATTERN_MATCH_FAILED, false, false) ;
+ if ( ShowResolverSetup ) {
+ System.out.println("---- Default settings ----") ;
+ printSetting(iriFactory) ;
+ }
- // iriFactory.shouldViolation(false,true);
+ setErrorWarning(iriFactory, ViolationCodes.UNREGISTERED_IANA_SCHEME, false, false) ;
+
+ // Turn off?? (ignored in CheckerIRI.iriViolations anyway).
+ // setErrorWarning(iriFactory, ViolationCodes.LOWERCASE_PREFERRED, false, false) ;
+ // setErrorWarning(iriFactory, ViolationCodes.PERCENT_ENCODING_SHOULD_BE_UPPERCASE, false, false) ;
+ // setErrorWarning(iriFactory, ViolationCodes.SCHEME_PATTERN_MATCH_FAILED, false, false) ;
- // NFC tests are not well understood and these cause confusion.
+ // NFC tests are not well understood and these cause confusion.
+ // See JENA-864
//iriFactory.setIsError(ViolationCodes.NOT_NFC, false) ;
//iriFactory.setIsError(ViolationCodes.NOT_NFKC, false) ;
// ** Applies to various unicode blocks.
- // XXX Default?
- // set(iriFactory, ViolationCodes.COMPATIBILITY_CHARACTER, false, false) ;
+ // setErrorWarning(iriFactory, ViolationCodes.COMPATIBILITY_CHARACTER, false, false) ;
+
+ // Moderate it -- allow unwise chars.
+ setErrorWarning(iriFactory, ViolationCodes.UNWISE_CHARACTER, false, false) ;
+ setErrorWarning(iriFactory, ViolationCodes.UNDEFINED_UNICODE_CHARACTER, false, false) ;
+
+ if ( ShowResolverSetup ) {
+ System.out.println("---- After initialization ----") ;
+ printSetting(iriFactory) ;
+ }
- // XXX Default?
- // Moderate it -- allow unwise chars and any scheme name.
- //set(iriFactory, ViolationCodes.UNWISE_CHARACTER, false, false) ;
- //set(iriFactory, ViolationCodes.UNDEFINED_UNICODE_CHARACTER, false, false) ;
}
+ // ---- Initialization support
+
/** Set the error/warnign state of a violation code.
* @param factory IRIFactory
* @param code ViolationCodes constant
@@ -83,6 +99,27 @@ public abstract class IRIResolver
factory.setIsWarning(code, isWarning);
}
+ private static void printSetting(IRIFactory factory) {
+ PrintStream ps = System.out ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.UNREGISTERED_IANA_SCHEME) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.NOT_NFC) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.NOT_NFKC) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.UNWISE_CHARACTER) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.UNDEFINED_UNICODE_CHARACTER) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.COMPATIBILITY_CHARACTER) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.LOWERCASE_PREFERRED) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.PERCENT_ENCODING_SHOULD_BE_UPPERCASE) ;
+ printErrorWarning(ps, iriFactory, ViolationCodes.SCHEME_PATTERN_MATCH_FAILED) ;
+ ps.println() ;
+ }
+
+ private static void printErrorWarning(PrintStream ps, IRIFactory factory, int code) {
+ String x = PatternCompiler.errorCodeName(code);
+ ps.printf("%-40s : E:%-5s W:%-5s\n", x, factory.isError(code), factory.isWarning(code)) ;
+ }
+
+ // ---- System-wide operations.
+
/** Check an IRI string (does not resolve it) */
public static boolean checkIRI(String iriStr) {
IRI iri = parseIRI(iriStr) ;
[3/5] jena git commit: JENA-1052: Switch to turn off absolute URI
normalization.
Posted by an...@apache.org.
JENA-1052: Switch to turn off absolute URI normalization.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/d0c232da
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/d0c232da
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/d0c232da
Branch: refs/heads/master
Commit: d0c232da999972b67df8f90d7100491f810b84cd
Parents: 10625df
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Oct 21 20:55:20 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Oct 21 20:55:20 2015 +0100
----------------------------------------------------------------------
.../main/java/org/apache/jena/riot/system/IRIResolver.java | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/d0c232da/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
index 2ecb8d1..297a74a 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
@@ -30,6 +30,7 @@ import org.apache.jena.iri.IRIFactory ;
import org.apache.jena.iri.ViolationCodes ;
import org.apache.jena.iri.impl.PatternCompiler ;
import org.apache.jena.riot.RiotException ;
+import org.apache.jena.riot.SysRIOT ;
/** IRI handling */
public abstract class IRIResolver
@@ -450,6 +451,12 @@ public abstract class IRIResolver
private IRI resolveSilentNoCache(String uriStr) {
IRI x = IRIResolver.iriFactory.create(uriStr) ;
+ if ( SysRIOT.StrictBaseURINoResolve ) {
+ // Always process "file:", even in strict mode.
+ // file: is widely used in irregular forms.
+ if ( x.isAbsolute() && ! uriStr.startsWith("file:") )
+ return x ;
+ }
return base.create(x) ;
}
[5/5] jena git commit: JENA-1052: Switch for on/off absolute URI
normalization.
Posted by an...@apache.org.
JENA-1052: Switch for on/off absolute URI normalization.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/2c3e8fe1
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/2c3e8fe1
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/2c3e8fe1
Branch: refs/heads/master
Commit: 2c3e8fe1b74e64b32a77071e5e9725dabb81e7f7
Parents: e770f33
Author: Andy Seaborne <an...@apache.org>
Authored: Wed Oct 21 20:59:53 2015 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Wed Oct 21 21:01:01 2015 +0100
----------------------------------------------------------------------
jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java | 10 +++++-----
.../java/org/apache/jena/riot/system/IRIResolver.java | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/2c3e8fe1/jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java b/jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java
index 94c094a..5174883 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/SysRIOT.java
@@ -31,18 +31,18 @@ public class SysRIOT
public static final String riotLoggerName = "org.apache.jena.riot" ;
private static Logger riotLogger = LoggerFactory.getLogger(riotLoggerName) ;
- public static boolean StrictXSDLexicialForms = false ;
- public static boolean StrictBaseURINoResolve = false ;
- public static boolean strictMode = false ;
+ public static boolean StrictXSDLexicialForms = false ;
+ public static boolean StrictAbsURINoNormalization = false ;
+ public static boolean strictMode = false ;
- public static final String BNodeGenIdPrefix = "genid" ;
+ public static final String BNodeGenIdPrefix = "genid" ;
public static final boolean isWindows = (File.pathSeparatorChar == ';' ) ;
public static void setStrictMode(boolean state) {
SysRIOT.strictMode = state ;
SysRIOT.StrictXSDLexicialForms = state ;
- SysRIOT.StrictBaseURINoResolve = state ;
+ SysRIOT.StrictAbsURINoNormalization = state ;
}
public static boolean isStrictMode() {
http://git-wip-us.apache.org/repos/asf/jena/blob/2c3e8fe1/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
index 297a74a..61762ab 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/IRIResolver.java
@@ -451,7 +451,7 @@ public abstract class IRIResolver
private IRI resolveSilentNoCache(String uriStr) {
IRI x = IRIResolver.iriFactory.create(uriStr) ;
- if ( SysRIOT.StrictBaseURINoResolve ) {
+ if ( SysRIOT.StrictAbsURINoNormalization ) {
// Always process "file:", even in strict mode.
// file: is widely used in irregular forms.
if ( x.isAbsolute() && ! uriStr.startsWith("file:") )