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 2016/10/10 11:03:48 UTC
jena git commit: Rename old,
deprecated IRIResolver as N3IRIResolver to avoid name clash
Repository: jena
Updated Branches:
refs/heads/master b15ca3b93 -> 1bcb9d20d
Rename old, deprecated IRIResolver as N3IRIResolver to avoid name clash
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/1bcb9d20
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/1bcb9d20
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/1bcb9d20
Branch: refs/heads/master
Commit: 1bcb9d20dab9c0ed0728735fb74925f1804c90d4
Parents: b15ca3b
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Oct 10 12:02:38 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Oct 10 12:02:38 2016 +0100
----------------------------------------------------------------------
.../java/org/apache/jena/n3/IRIResolver.java | 231 -------------------
.../java/org/apache/jena/n3/JenaReaderBase.java | 2 +-
.../java/org/apache/jena/n3/N3IRIResolver.java | 231 +++++++++++++++++++
.../org/apache/jena/n3/turtle/ParserBase.java | 6 +-
.../java/org/apache/jena/n3/TestResolver.java | 26 +--
.../jena/rdf/model/test/TestModelRead.java | 2 +-
.../testing_framework/manifest/Manifest.java | 4 +-
.../org/apache/jena/util/junit/Manifest.java | 2 +-
8 files changed, 252 insertions(+), 252 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java b/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
deleted file mode 100644
index 268634b..0000000
--- a/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.jena.n3;
-
-
-import org.apache.jena.iri.IRI;
-import org.apache.jena.iri.IRIException;
-import org.apache.jena.iri.IRIFactory;
-import org.apache.jena.util.FileUtils ;
-
-/** A simple class to access IRI resolution.
- * Replaced by {@code org.apache.jena.riot.system.IRIResolver}
- */
-
-@Deprecated
-public class IRIResolver {
- /**
- * The current working directory, as a string.
- */
- static private String globalBase = "http://localhost/LocalHostBase/" ;
-
- // Try to set the global base from the current directory.
- // Security (e.g. Tomcat) may prevent this in which case we
- // use a common default set above.
- static {
- try { globalBase = FileUtils.toURL("."); }
- catch (Throwable th) { }
- }
-
- /**
- * The current working directory, as an IRI.
- */
- static final IRI cwd;
-
- /**
- * An IRIFactory appropriately configuired.
- */
- static final IRIFactory factory = new IRIFactory(IRIFactory
- .jenaImplementation());
- static {
- factory.setSameSchemeRelativeReferences("file");
- }
-
- static {
-
- IRI cwdx;
- try {
- cwdx = factory.construct(globalBase);
- } catch (IRIException e) {
- System.err.println("Unexpected IRIException in initializer: "
- + e.getMessage());
- cwdx = factory.create("file:///");
- }
- cwd = cwdx;
- }
-
-
-
- /**
- * Turn a filename into a well-formed file: URL relative to the working
- * directory.
- *
- * @param filename
- * @return String The filename as an absolute URL
- */
- static public String resolveFileURL(String filename) throws IRIException {
- IRI r = cwd.resolve(filename);
- if (!r.getScheme().equalsIgnoreCase("file")) {
- return resolveFileURL("./" + filename);
- }
- return r.toString();
- }
-
- /**
- * Create resolve a URI against a base. If baseStr is a relative file IRI
- * then it is first resolved against the current working directory.
- *
- * @param relStr
- * @param baseStr
- * Can be null if relStr is absolute
- * @return String An absolute URI
- * @throws JenaURIException
- * If result would not be legal, absolute IRI
- */
- static public String resolve(String relStr, String baseStr)
- throws JenaURIException {
- return exceptions(resolveIRI(relStr, baseStr)).toString();
- }
-
- /*
- * No exception thrown by this method.
- */
- static private IRI resolveIRI(String relStr, String baseStr) {
- IRI i = factory.create(relStr);
- if (i.isAbsolute())
- // removes excess . segments
- return cwd.create(i);
-
- IRI base = factory.create(baseStr);
-
- if ("file".equalsIgnoreCase(base.getScheme()))
- return cwd.create(base).create(i);
- return base.create(i);
- }
-
- final private IRI base;
-
- /**
- * Construct an IRIResolver with base as the
- * current working directory.
- *
- */
- public IRIResolver() {
- this(null);
- }
-
- /**
- * Construct an IRIResolver with base determined
- * by the argument URI. If this is relative,
- * it is relative against the current working directory.
- * @param baseS
- *
- * @throws JenaURIException
- * If resulting base would not be legal, absolute IRI
- */
- public IRIResolver(String baseS) {
- if (baseS == null)
- baseS = chooseBaseURI();
- // IRI aaa = RelURI.factory.construct(baseS);
- base = exceptions(cwd.create(baseS));
- }
-
- /**
- * The base of this IRIResolver.
- * @return String
- */
- public String getBaseIRI() {
- return base.toString();
- }
-
- /**
- * Resolve the relative URI against the base of
- * this IRIResolver.
- * @param relURI
- * @return the resolved IRI
- * @throws JenaURIException
- * If resulting URI would not be legal, absolute IRI
-
- */
- public String resolve(String relURI) {
- return exceptions(base.resolve(relURI)).toString();
- }
-
-
- /**
- * Throw any exceptions resulting from IRI.
- * @param iri
- * @return iri
- */
- static private IRI exceptions(IRI iri) {
- if (showExceptions && iri.hasViolation(false)) {
- try {
- cwd.construct(iri);
- } catch (IRIException e) {
- throw new JenaURIException(e);
- }
- }
- return iri;
- }
-
- private static boolean showExceptions = true;
-
- /**
- To allow Eyeball to bypass IRI checking (because it's doing its own)
- */
- public static void suppressExceptions()
- { setShowExceptions(false) ; }
-
- /** To allow Eyeball to bypass IRI checking (because it's doing its own) */
- public static void setShowExceptions(boolean state)
- { showExceptions = state ; }
-
-/**
- * Resolve the relative URI str against the current
- * working directory.
- * @param str
- * @return String
- */
- public static String resolveGlobal(String str) {
- return exceptions(cwd.resolve(str)).toString();
- }
-
- /**
- * Choose a base URI based on the current directory
- *
- * @return String Absolute URI
- */
-
- static public String chooseBaseURI() {
- return chooseBaseURI(null);
- }
-
- /**
- * Choose a baseURI based on a suggestion
- *
- * @return String URI (if relative, relative to current working directory).
- */
-
- static public String chooseBaseURI(String baseURI) {
- if (baseURI == null)
- baseURI = "file:.";
- return resolveGlobal(baseURI);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java b/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
index dff0c55..2e386c8 100644
--- a/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
+++ b/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
@@ -110,7 +110,7 @@ public abstract class JenaReaderBase implements RDFReader
// The reader has been checked, if possible, by now or
// constructed correctly by code here.
if ( base != null )
- base = IRIResolver.resolveGlobal(base) ;
+ base = N3IRIResolver.resolveGlobal(base) ;
try {
model.notifyEvent( GraphEvents.startRead );
readWorker(model, reader, base) ;
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
new file mode 100644
index 0000000..f8ba6de
--- /dev/null
+++ b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
@@ -0,0 +1,231 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.n3;
+
+
+import org.apache.jena.iri.IRI;
+import org.apache.jena.iri.IRIException;
+import org.apache.jena.iri.IRIFactory;
+import org.apache.jena.util.FileUtils ;
+
+/** A simple class to access IRI resolution.
+ * Replaced by {@code org.apache.jena.riot.system.IRIResolver}
+ */
+
+@Deprecated
+public class N3IRIResolver {
+ /**
+ * The current working directory, as a string.
+ */
+ static private String globalBase = "http://localhost/LocalHostBase/" ;
+
+ // Try to set the global base from the current directory.
+ // Security (e.g. Tomcat) may prevent this in which case we
+ // use a common default set above.
+ static {
+ try { globalBase = FileUtils.toURL("."); }
+ catch (Throwable th) { }
+ }
+
+ /**
+ * The current working directory, as an IRI.
+ */
+ static final IRI cwd;
+
+ /**
+ * An IRIFactory appropriately configuired.
+ */
+ static final IRIFactory factory = new IRIFactory(IRIFactory
+ .jenaImplementation());
+ static {
+ factory.setSameSchemeRelativeReferences("file");
+ }
+
+ static {
+
+ IRI cwdx;
+ try {
+ cwdx = factory.construct(globalBase);
+ } catch (IRIException e) {
+ System.err.println("Unexpected IRIException in initializer: "
+ + e.getMessage());
+ cwdx = factory.create("file:///");
+ }
+ cwd = cwdx;
+ }
+
+
+
+ /**
+ * Turn a filename into a well-formed file: URL relative to the working
+ * directory.
+ *
+ * @param filename
+ * @return String The filename as an absolute URL
+ */
+ static public String resolveFileURL(String filename) throws IRIException {
+ IRI r = cwd.resolve(filename);
+ if (!r.getScheme().equalsIgnoreCase("file")) {
+ return resolveFileURL("./" + filename);
+ }
+ return r.toString();
+ }
+
+ /**
+ * Create resolve a URI against a base. If baseStr is a relative file IRI
+ * then it is first resolved against the current working directory.
+ *
+ * @param relStr
+ * @param baseStr
+ * Can be null if relStr is absolute
+ * @return String An absolute URI
+ * @throws JenaURIException
+ * If result would not be legal, absolute IRI
+ */
+ static public String resolve(String relStr, String baseStr)
+ throws JenaURIException {
+ return exceptions(resolveIRI(relStr, baseStr)).toString();
+ }
+
+ /*
+ * No exception thrown by this method.
+ */
+ static private IRI resolveIRI(String relStr, String baseStr) {
+ IRI i = factory.create(relStr);
+ if (i.isAbsolute())
+ // removes excess . segments
+ return cwd.create(i);
+
+ IRI base = factory.create(baseStr);
+
+ if ("file".equalsIgnoreCase(base.getScheme()))
+ return cwd.create(base).create(i);
+ return base.create(i);
+ }
+
+ final private IRI base;
+
+ /**
+ * Construct an IRIResolver with base as the
+ * current working directory.
+ *
+ */
+ public N3IRIResolver() {
+ this(null);
+ }
+
+ /**
+ * Construct an IRIResolver with base determined
+ * by the argument URI. If this is relative,
+ * it is relative against the current working directory.
+ * @param baseS
+ *
+ * @throws JenaURIException
+ * If resulting base would not be legal, absolute IRI
+ */
+ public N3IRIResolver(String baseS) {
+ if (baseS == null)
+ baseS = chooseBaseURI();
+ // IRI aaa = RelURI.factory.construct(baseS);
+ base = exceptions(cwd.create(baseS));
+ }
+
+ /**
+ * The base of this IRIResolver.
+ * @return String
+ */
+ public String getBaseIRI() {
+ return base.toString();
+ }
+
+ /**
+ * Resolve the relative URI against the base of
+ * this IRIResolver.
+ * @param relURI
+ * @return the resolved IRI
+ * @throws JenaURIException
+ * If resulting URI would not be legal, absolute IRI
+
+ */
+ public String resolve(String relURI) {
+ return exceptions(base.resolve(relURI)).toString();
+ }
+
+
+ /**
+ * Throw any exceptions resulting from IRI.
+ * @param iri
+ * @return iri
+ */
+ static private IRI exceptions(IRI iri) {
+ if (showExceptions && iri.hasViolation(false)) {
+ try {
+ cwd.construct(iri);
+ } catch (IRIException e) {
+ throw new JenaURIException(e);
+ }
+ }
+ return iri;
+ }
+
+ private static boolean showExceptions = true;
+
+ /**
+ To allow Eyeball to bypass IRI checking (because it's doing its own)
+ */
+ public static void suppressExceptions()
+ { setShowExceptions(false) ; }
+
+ /** To allow Eyeball to bypass IRI checking (because it's doing its own) */
+ public static void setShowExceptions(boolean state)
+ { showExceptions = state ; }
+
+/**
+ * Resolve the relative URI str against the current
+ * working directory.
+ * @param str
+ * @return String
+ */
+ public static String resolveGlobal(String str) {
+ return exceptions(cwd.resolve(str)).toString();
+ }
+
+ /**
+ * Choose a base URI based on the current directory
+ *
+ * @return String Absolute URI
+ */
+
+ static public String chooseBaseURI() {
+ return chooseBaseURI(null);
+ }
+
+ /**
+ * Choose a baseURI based on a suggestion
+ *
+ * @return String URI (if relative, relative to current working directory).
+ */
+
+ static public String chooseBaseURI(String baseURI) {
+ if (baseURI == null)
+ baseURI = "file:.";
+ return resolveGlobal(baseURI);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java b/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
index bd581a5..197e231 100644
--- a/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
+++ b/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
@@ -24,7 +24,7 @@ import org.apache.jena.datatypes.xsd.XSDDatatype ;
import org.apache.jena.graph.Node ;
import org.apache.jena.graph.NodeFactory ;
import org.apache.jena.graph.Triple ;
-import org.apache.jena.n3.IRIResolver ;
+import org.apache.jena.n3.N3IRIResolver ;
import org.apache.jena.n3.JenaURIException ;
import org.apache.jena.shared.PrefixMapping ;
import org.apache.jena.shared.impl.PrefixMappingImpl ;
@@ -59,12 +59,12 @@ public class ParserBase
public ParserBase() {}
PrefixMapping prefixMapping = new PrefixMappingImpl() ;
- IRIResolver resolver = new IRIResolver() ;
+ N3IRIResolver resolver = new N3IRIResolver() ;
protected String getBaseURI() { return resolver.getBaseIRI() ; }
public void setBaseURI(String u)
{
- resolver = new IRIResolver(u) ;
+ resolver = new N3IRIResolver(u) ;
}
protected void setBase(String iriStr , int line, int column)
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java b/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
index 13a348e..832a4b7 100644
--- a/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
+++ b/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
@@ -20,7 +20,7 @@ package org.apache.jena.n3;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.jena.n3.IRIResolver ;
+import org.apache.jena.n3.N3IRIResolver ;
import org.apache.jena.n3.JenaURIException ;
@SuppressWarnings("deprecation")
public class TestResolver extends TestCase
@@ -34,7 +34,7 @@ public class TestResolver extends TestCase
public void testBase1()
{
- IRIResolver resolver = new IRIResolver() ;
+ N3IRIResolver resolver = new N3IRIResolver() ;
assertNotNull(resolver.getBaseIRI()) ;
String base = resolver.getBaseIRI() ;
assertTrue(base.indexOf(':') > 0 ) ;
@@ -42,7 +42,7 @@ public class TestResolver extends TestCase
public void testBase2()
{
- IRIResolver resolver = new IRIResolver("x") ;
+ N3IRIResolver resolver = new N3IRIResolver("x") ;
assertNotNull(resolver.getBaseIRI()) ;
// Active when IRI library integrated - currently the resolver takes a raw base string.
// String base = resolver.getBaseIRI() ;
@@ -51,8 +51,8 @@ public class TestResolver extends TestCase
public void testBase3()
{
- String b = IRIResolver.resolveGlobal("x") ;
- IRIResolver resolver = new IRIResolver(b) ;
+ String b = N3IRIResolver.resolveGlobal("x") ;
+ N3IRIResolver resolver = new N3IRIResolver(b) ;
assertNotNull(resolver.getBaseIRI()) ;
String base = resolver.getBaseIRI() ;
assertTrue(base.indexOf(':') > 0 ) ;
@@ -238,7 +238,7 @@ public class TestResolver extends TestCase
private void execTest(String u, String base, String result)
{
- IRIResolver resolver = new IRIResolver(base) ;
+ N3IRIResolver resolver = new N3IRIResolver(base) ;
String res = resolver.resolve(u) ;
if (result == null )
@@ -254,7 +254,7 @@ public class TestResolver extends TestCase
// A test for resolved names that depend on where the tests are run.
private void execTestMatch(String u, String base, String resultPattern)
{
- IRIResolver resolver = new IRIResolver(base) ;
+ N3IRIResolver resolver = new N3IRIResolver(base) ;
String res = resolver.resolve(u) ;
if (resultPattern == null )
@@ -269,14 +269,14 @@ public class TestResolver extends TestCase
private void execFileTest(String fn1, String fn2)
{
- String s = IRIResolver.resolveFileURL(fn1) ;
+ String s = N3IRIResolver.resolveFileURL(fn1) ;
assertEquals(s,fn2) ;
}
private void execTestFileRelURI(String fn)
{
String relName = fn.substring("file:".length()) ;
- String s = IRIResolver.resolveFileURL(fn) ;
+ String s = N3IRIResolver.resolveFileURL(fn) ;
assertTrue("Lost relative name: ("+fn+"=>"+s+")", s.endsWith(relName) ) ;
assertTrue("Not absolute: ("+fn+"=>"+s+")", s.startsWith("file:///") ) ;
}
@@ -285,7 +285,7 @@ public class TestResolver extends TestCase
{
String s = ex.getSimpleName() ;
try {
- IRIResolver resolver = new IRIResolver(base) ;
+ N3IRIResolver resolver = new N3IRIResolver(base) ;
String res = resolver.resolve(u) ;
if ( res == null )
fail("("+u+","+base+") => <null> :: Expected exception: " +s) ;
@@ -301,7 +301,7 @@ public class TestResolver extends TestCase
{
String s = ex.getSimpleName() ;
try {
- new IRIResolver(base) ;
+ new N3IRIResolver(base) ;
fail("("+base+") => OK :: Expected exception: " +s) ;
} catch (Exception ex2)
{
@@ -312,14 +312,14 @@ public class TestResolver extends TestCase
private void choose(String base)
{
- IRIResolver.chooseBaseURI(base) ;
+ N3IRIResolver.chooseBaseURI(base) ;
}
private void chooseException(String base, Class<?> ex)
{
String s = ex.getSimpleName() ;
try {
- IRIResolver.chooseBaseURI(base) ;
+ N3IRIResolver.chooseBaseURI(base) ;
fail("("+base+") => OK :: Expected exception: " +s) ;
} catch (Exception ex2)
{
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
index c4a7e26..4551fee 100644
--- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
+++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
@@ -69,7 +69,7 @@ public class TestModelRead extends AbstractModelTestBase
@SuppressWarnings("deprecation")
public void testSimpleLoadImplictBase() throws IRIException {
final Model mBasedImplicit = createModel() ;
- String fn=org.apache.jena.n3.IRIResolver.resolveGlobal(getFileName("modelReading/based.n3"));
+ String fn=org.apache.jena.n3.N3IRIResolver.resolveGlobal(getFileName("modelReading/based.n3"));
final Model wanted = createModel().add(ModelHelper.resource(fn), ModelHelper.property("ja:predicate"),
ModelHelper.resource("ja:object")) ;
mBasedImplicit.read(fn, "N3") ;
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java b/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java
index 9ff4354..af2259a 100644
--- a/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java
+++ b/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java
@@ -23,7 +23,7 @@ import java.util.Collection ;
import java.util.Iterator ;
import java.util.List ;
-import org.apache.jena.n3.IRIResolver ;
+import org.apache.jena.n3.N3IRIResolver ;
import org.apache.jena.rdf.model.* ;
import org.apache.jena.util.FileManager ;
import org.apache.jena.vocabulary.RDF ;
@@ -49,7 +49,7 @@ public class Manifest {
public Manifest(String fn) {
log.debug("Manifest = " + fn);
- filename = IRIResolver.resolveGlobal(fn);
+ filename = N3IRIResolver.resolveGlobal(fn);
log.debug(" = " + filename);
manifest = FileManager.get().loadModel(filename);
parseIncludes();
http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java b/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
index e76d3f5..49362cd 100644
--- a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
+++ b/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
@@ -50,7 +50,7 @@ public class Manifest
public Manifest(String fn)
{
log.debug("Manifest = "+fn ) ;
- filename = org.apache.jena.n3.IRIResolver.resolveGlobal(fn) ;
+ filename = org.apache.jena.n3.N3IRIResolver.resolveGlobal(fn) ;
log.debug(" = "+filename ) ;
manifest = FileManager.get().loadModel(filename) ;
parseIncludes() ;
Re: jena git commit: Rename old, deprecated IRIResolver as
N3IRIResolver to avoid name clash
Posted by Andy Seaborne <an...@apache.org>.
Wrong module currently.
The old Turtle subsystem remains while core depends on Turtle tests -
the N3IRResolver is part of that.
Andy
On 10/10/16 12:07, Claude Warren wrote:
> it might make sense to change
> .../jena/rdf/model/test/TestModelRead.java
> to use the new IRIResolver. I think the test code is just using it to
> resolve file names.
>
> Claude
>
> On Mon, Oct 10, 2016 at 12:03 PM, <an...@apache.org> wrote:
>
>> Repository: jena
>> Updated Branches:
>> refs/heads/master b15ca3b93 -> 1bcb9d20d
>>
>>
>> Rename old, deprecated IRIResolver as N3IRIResolver to avoid name clash
>>
>> Project: http://git-wip-us.apache.org/repos/asf/jena/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/1bcb9d20
>> Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/1bcb9d20
>> Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/1bcb9d20
>>
>> Branch: refs/heads/master
>> Commit: 1bcb9d20dab9c0ed0728735fb74925f1804c90d4
>> Parents: b15ca3b
>> Author: Andy Seaborne <an...@apache.org>
>> Authored: Mon Oct 10 12:02:38 2016 +0100
>> Committer: Andy Seaborne <an...@apache.org>
>> Committed: Mon Oct 10 12:02:38 2016 +0100
>>
>> ----------------------------------------------------------------------
>> .../java/org/apache/jena/n3/IRIResolver.java | 231 -------------------
>> .../java/org/apache/jena/n3/JenaReaderBase.java | 2 +-
>> .../java/org/apache/jena/n3/N3IRIResolver.java | 231 +++++++++++++++++++
>> .../org/apache/jena/n3/turtle/ParserBase.java | 6 +-
>> .../java/org/apache/jena/n3/TestResolver.java | 26 +--
>> .../jena/rdf/model/test/TestModelRead.java | 2 +-
>> .../testing_framework/manifest/Manifest.java | 4 +-
>> .../org/apache/jena/util/junit/Manifest.java | 2 +-
>> 8 files changed, 252 insertions(+), 252 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
>> b/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
>> deleted file mode 100644
>> index 268634b..0000000
>> --- a/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
>> +++ /dev/null
>> @@ -1,231 +0,0 @@
>> -/*
>> - * Licensed to the Apache Software Foundation (ASF) under one
>> - * or more contributor license agreements. See the NOTICE file
>> - * distributed with this work for additional information
>> - * regarding copyright ownership. The ASF licenses this file
>> - * to you under the Apache License, Version 2.0 (the
>> - * "License"); you may not use this file except in compliance
>> - * with the License. You may obtain a copy of the License at
>> - *
>> - * http://www.apache.org/licenses/LICENSE-2.0
>> - *
>> - * Unless required by applicable law or agreed to in writing, software
>> - * distributed under the License is distributed on an "AS IS" BASIS,
>> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> - * See the License for the specific language governing permissions and
>> - * limitations under the License.
>> - */
>> -
>> -package org.apache.jena.n3;
>> -
>> -
>> -import org.apache.jena.iri.IRI;
>> -import org.apache.jena.iri.IRIException;
>> -import org.apache.jena.iri.IRIFactory;
>> -import org.apache.jena.util.FileUtils ;
>> -
>> -/** A simple class to access IRI resolution.
>> - * Replaced by {@code org.apache.jena.riot.system.IRIResolver}
>> - */
>> -
>> -@Deprecated
>> -public class IRIResolver {
>> - /**
>> - * The current working directory, as a string.
>> - */
>> - static private String globalBase = "http://localhost/
>> LocalHostBase/" ;
>> -
>> - // Try to set the global base from the current directory.
>> - // Security (e.g. Tomcat) may prevent this in which case we
>> - // use a common default set above.
>> - static {
>> - try { globalBase = FileUtils.toURL("."); }
>> - catch (Throwable th) { }
>> - }
>> -
>> - /**
>> - * The current working directory, as an IRI.
>> - */
>> - static final IRI cwd;
>> -
>> - /**
>> - * An IRIFactory appropriately configuired.
>> - */
>> - static final IRIFactory factory = new IRIFactory(IRIFactory
>> - .jenaImplementation());
>> - static {
>> - factory.setSameSchemeRelativeReferences("file");
>> - }
>> -
>> - static {
>> -
>> - IRI cwdx;
>> - try {
>> - cwdx = factory.construct(globalBase);
>> - } catch (IRIException e) {
>> - System.err.println("Unexpected IRIException in
>> initializer: "
>> - + e.getMessage());
>> - cwdx = factory.create("file:///");
>> - }
>> - cwd = cwdx;
>> - }
>> -
>> -
>> -
>> - /**
>> - * Turn a filename into a well-formed file: URL relative to the
>> working
>> - * directory.
>> - *
>> - * @param filename
>> - * @return String The filename as an absolute URL
>> - */
>> - static public String resolveFileURL(String filename) throws
>> IRIException {
>> - IRI r = cwd.resolve(filename);
>> - if (!r.getScheme().equalsIgnoreCase("file")) {
>> - return resolveFileURL("./" + filename);
>> - }
>> - return r.toString();
>> - }
>> -
>> - /**
>> - * Create resolve a URI against a base. If baseStr is a relative
>> file IRI
>> - * then it is first resolved against the current working directory.
>> - *
>> - * @param relStr
>> - * @param baseStr
>> - * Can be null if relStr is absolute
>> - * @return String An absolute URI
>> - * @throws JenaURIException
>> - * If result would not be legal, absolute IRI
>> - */
>> - static public String resolve(String relStr, String baseStr)
>> - throws JenaURIException {
>> - return exceptions(resolveIRI(relStr, baseStr)).toString();
>> - }
>> -
>> - /*
>> - * No exception thrown by this method.
>> - */
>> - static private IRI resolveIRI(String relStr, String baseStr) {
>> - IRI i = factory.create(relStr);
>> - if (i.isAbsolute())
>> - // removes excess . segments
>> - return cwd.create(i);
>> -
>> - IRI base = factory.create(baseStr);
>> -
>> - if ("file".equalsIgnoreCase(base.getScheme()))
>> - return cwd.create(base).create(i);
>> - return base.create(i);
>> - }
>> -
>> - final private IRI base;
>> -
>> - /**
>> - * Construct an IRIResolver with base as the
>> - * current working directory.
>> - *
>> - */
>> - public IRIResolver() {
>> - this(null);
>> - }
>> -
>> - /**
>> - * Construct an IRIResolver with base determined
>> - * by the argument URI. If this is relative,
>> - * it is relative against the current working directory.
>> - * @param baseS
>> - *
>> - * @throws JenaURIException
>> - * If resulting base would not be legal, absolute IRI
>> - */
>> - public IRIResolver(String baseS) {
>> - if (baseS == null)
>> - baseS = chooseBaseURI();
>> - // IRI aaa = RelURI.factory.construct(baseS);
>> - base = exceptions(cwd.create(baseS));
>> - }
>> -
>> - /**
>> - * The base of this IRIResolver.
>> - * @return String
>> - */
>> - public String getBaseIRI() {
>> - return base.toString();
>> - }
>> -
>> - /**
>> - * Resolve the relative URI against the base of
>> - * this IRIResolver.
>> - * @param relURI
>> - * @return the resolved IRI
>> - * @throws JenaURIException
>> - * If resulting URI would not be legal, absolute IRI
>> -
>> - */
>> - public String resolve(String relURI) {
>> - return exceptions(base.resolve(relURI)).toString();
>> - }
>> -
>> -
>> - /**
>> - * Throw any exceptions resulting from IRI.
>> - * @param iri
>> - * @return iri
>> - */
>> - static private IRI exceptions(IRI iri) {
>> - if (showExceptions && iri.hasViolation(false)) {
>> - try {
>> - cwd.construct(iri);
>> - } catch (IRIException e) {
>> - throw new JenaURIException(e);
>> - }
>> - }
>> - return iri;
>> - }
>> -
>> - private static boolean showExceptions = true;
>> -
>> - /**
>> - To allow Eyeball to bypass IRI checking (because it's doing
>> its own)
>> - */
>> - public static void suppressExceptions()
>> - { setShowExceptions(false) ; }
>> -
>> - /** To allow Eyeball to bypass IRI checking (because it's doing
>> its own) */
>> - public static void setShowExceptions(boolean state)
>> - { showExceptions = state ; }
>> -
>> -/**
>> - * Resolve the relative URI str against the current
>> - * working directory.
>> - * @param str
>> - * @return String
>> - */
>> - public static String resolveGlobal(String str) {
>> - return exceptions(cwd.resolve(str)).toString();
>> - }
>> -
>> - /**
>> - * Choose a base URI based on the current directory
>> - *
>> - * @return String Absolute URI
>> - */
>> -
>> - static public String chooseBaseURI() {
>> - return chooseBaseURI(null);
>> - }
>> -
>> - /**
>> - * Choose a baseURI based on a suggestion
>> - *
>> - * @return String URI (if relative, relative to current working
>> directory).
>> - */
>> -
>> - static public String chooseBaseURI(String baseURI) {
>> - if (baseURI == null)
>> - baseURI = "file:.";
>> - return resolveGlobal(baseURI);
>> - }
>> -
>> -}
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
>> b/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
>> index dff0c55..2e386c8 100644
>> --- a/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
>> +++ b/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
>> @@ -110,7 +110,7 @@ public abstract class JenaReaderBase implements
>> RDFReader
>> // The reader has been checked, if possible, by now or
>> // constructed correctly by code here.
>> if ( base != null )
>> - base = IRIResolver.resolveGlobal(base) ;
>> + base = N3IRIResolver.resolveGlobal(base) ;
>> try {
>> model.notifyEvent( GraphEvents.startRead );
>> readWorker(model, reader, base) ;
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
>> b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
>> new file mode 100644
>> index 0000000..f8ba6de
>> --- /dev/null
>> +++ b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
>> @@ -0,0 +1,231 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one
>> + * or more contributor license agreements. See the NOTICE file
>> + * distributed with this work for additional information
>> + * regarding copyright ownership. The ASF licenses this file
>> + * to you under the Apache License, Version 2.0 (the
>> + * "License"); you may not use this file except in compliance
>> + * with the License. You may obtain a copy of the License at
>> + *
>> + * http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the License for the specific language governing permissions and
>> + * limitations under the License.
>> + */
>> +
>> +package org.apache.jena.n3;
>> +
>> +
>> +import org.apache.jena.iri.IRI;
>> +import org.apache.jena.iri.IRIException;
>> +import org.apache.jena.iri.IRIFactory;
>> +import org.apache.jena.util.FileUtils ;
>> +
>> +/** A simple class to access IRI resolution.
>> + * Replaced by {@code org.apache.jena.riot.system.IRIResolver}
>> + */
>> +
>> +@Deprecated
>> +public class N3IRIResolver {
>> + /**
>> + * The current working directory, as a string.
>> + */
>> + static private String globalBase = "http://localhost/
>> LocalHostBase/" ;
>> +
>> + // Try to set the global base from the current directory.
>> + // Security (e.g. Tomcat) may prevent this in which case we
>> + // use a common default set above.
>> + static {
>> + try { globalBase = FileUtils.toURL("."); }
>> + catch (Throwable th) { }
>> + }
>> +
>> + /**
>> + * The current working directory, as an IRI.
>> + */
>> + static final IRI cwd;
>> +
>> + /**
>> + * An IRIFactory appropriately configuired.
>> + */
>> + static final IRIFactory factory = new IRIFactory(IRIFactory
>> + .jenaImplementation());
>> + static {
>> + factory.setSameSchemeRelativeReferences("file");
>> + }
>> +
>> + static {
>> +
>> + IRI cwdx;
>> + try {
>> + cwdx = factory.construct(globalBase);
>> + } catch (IRIException e) {
>> + System.err.println("Unexpected IRIException in
>> initializer: "
>> + + e.getMessage());
>> + cwdx = factory.create("file:///");
>> + }
>> + cwd = cwdx;
>> + }
>> +
>> +
>> +
>> + /**
>> + * Turn a filename into a well-formed file: URL relative to the
>> working
>> + * directory.
>> + *
>> + * @param filename
>> + * @return String The filename as an absolute URL
>> + */
>> + static public String resolveFileURL(String filename) throws
>> IRIException {
>> + IRI r = cwd.resolve(filename);
>> + if (!r.getScheme().equalsIgnoreCase("file")) {
>> + return resolveFileURL("./" + filename);
>> + }
>> + return r.toString();
>> + }
>> +
>> + /**
>> + * Create resolve a URI against a base. If baseStr is a relative
>> file IRI
>> + * then it is first resolved against the current working directory.
>> + *
>> + * @param relStr
>> + * @param baseStr
>> + * Can be null if relStr is absolute
>> + * @return String An absolute URI
>> + * @throws JenaURIException
>> + * If result would not be legal, absolute IRI
>> + */
>> + static public String resolve(String relStr, String baseStr)
>> + throws JenaURIException {
>> + return exceptions(resolveIRI(relStr, baseStr)).toString();
>> + }
>> +
>> + /*
>> + * No exception thrown by this method.
>> + */
>> + static private IRI resolveIRI(String relStr, String baseStr) {
>> + IRI i = factory.create(relStr);
>> + if (i.isAbsolute())
>> + // removes excess . segments
>> + return cwd.create(i);
>> +
>> + IRI base = factory.create(baseStr);
>> +
>> + if ("file".equalsIgnoreCase(base.getScheme()))
>> + return cwd.create(base).create(i);
>> + return base.create(i);
>> + }
>> +
>> + final private IRI base;
>> +
>> + /**
>> + * Construct an IRIResolver with base as the
>> + * current working directory.
>> + *
>> + */
>> + public N3IRIResolver() {
>> + this(null);
>> + }
>> +
>> + /**
>> + * Construct an IRIResolver with base determined
>> + * by the argument URI. If this is relative,
>> + * it is relative against the current working directory.
>> + * @param baseS
>> + *
>> + * @throws JenaURIException
>> + * If resulting base would not be legal, absolute IRI
>> + */
>> + public N3IRIResolver(String baseS) {
>> + if (baseS == null)
>> + baseS = chooseBaseURI();
>> + // IRI aaa = RelURI.factory.construct(baseS);
>> + base = exceptions(cwd.create(baseS));
>> + }
>> +
>> + /**
>> + * The base of this IRIResolver.
>> + * @return String
>> + */
>> + public String getBaseIRI() {
>> + return base.toString();
>> + }
>> +
>> + /**
>> + * Resolve the relative URI against the base of
>> + * this IRIResolver.
>> + * @param relURI
>> + * @return the resolved IRI
>> + * @throws JenaURIException
>> + * If resulting URI would not be legal, absolute IRI
>> +
>> + */
>> + public String resolve(String relURI) {
>> + return exceptions(base.resolve(relURI)).toString();
>> + }
>> +
>> +
>> + /**
>> + * Throw any exceptions resulting from IRI.
>> + * @param iri
>> + * @return iri
>> + */
>> + static private IRI exceptions(IRI iri) {
>> + if (showExceptions && iri.hasViolation(false)) {
>> + try {
>> + cwd.construct(iri);
>> + } catch (IRIException e) {
>> + throw new JenaURIException(e);
>> + }
>> + }
>> + return iri;
>> + }
>> +
>> + private static boolean showExceptions = true;
>> +
>> + /**
>> + To allow Eyeball to bypass IRI checking (because it's doing
>> its own)
>> + */
>> + public static void suppressExceptions()
>> + { setShowExceptions(false) ; }
>> +
>> + /** To allow Eyeball to bypass IRI checking (because it's doing
>> its own) */
>> + public static void setShowExceptions(boolean state)
>> + { showExceptions = state ; }
>> +
>> +/**
>> + * Resolve the relative URI str against the current
>> + * working directory.
>> + * @param str
>> + * @return String
>> + */
>> + public static String resolveGlobal(String str) {
>> + return exceptions(cwd.resolve(str)).toString();
>> + }
>> +
>> + /**
>> + * Choose a base URI based on the current directory
>> + *
>> + * @return String Absolute URI
>> + */
>> +
>> + static public String chooseBaseURI() {
>> + return chooseBaseURI(null);
>> + }
>> +
>> + /**
>> + * Choose a baseURI based on a suggestion
>> + *
>> + * @return String URI (if relative, relative to current working
>> directory).
>> + */
>> +
>> + static public String chooseBaseURI(String baseURI) {
>> + if (baseURI == null)
>> + baseURI = "file:.";
>> + return resolveGlobal(baseURI);
>> + }
>> +
>> +}
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
>> b/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
>> index bd581a5..197e231 100644
>> --- a/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
>> +++ b/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
>> @@ -24,7 +24,7 @@ import org.apache.jena.datatypes.xsd.XSDDatatype ;
>> import org.apache.jena.graph.Node ;
>> import org.apache.jena.graph.NodeFactory ;
>> import org.apache.jena.graph.Triple ;
>> -import org.apache.jena.n3.IRIResolver ;
>> +import org.apache.jena.n3.N3IRIResolver ;
>> import org.apache.jena.n3.JenaURIException ;
>> import org.apache.jena.shared.PrefixMapping ;
>> import org.apache.jena.shared.impl.PrefixMappingImpl ;
>> @@ -59,12 +59,12 @@ public class ParserBase
>> public ParserBase() {}
>>
>> PrefixMapping prefixMapping = new PrefixMappingImpl() ;
>> - IRIResolver resolver = new IRIResolver() ;
>> + N3IRIResolver resolver = new N3IRIResolver() ;
>>
>> protected String getBaseURI() { return resolver.getBaseIRI() ; }
>> public void setBaseURI(String u)
>> {
>> - resolver = new IRIResolver(u) ;
>> + resolver = new N3IRIResolver(u) ;
>> }
>>
>> protected void setBase(String iriStr , int line, int column)
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
>> b/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
>> index 13a348e..832a4b7 100644
>> --- a/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
>> +++ b/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
>> @@ -20,7 +20,7 @@ package org.apache.jena.n3;
>>
>> import junit.framework.TestCase;
>> import junit.framework.TestSuite;
>> -import org.apache.jena.n3.IRIResolver ;
>> +import org.apache.jena.n3.N3IRIResolver ;
>> import org.apache.jena.n3.JenaURIException ;
>> @SuppressWarnings("deprecation")
>> public class TestResolver extends TestCase
>> @@ -34,7 +34,7 @@ public class TestResolver extends TestCase
>>
>> public void testBase1()
>> {
>> - IRIResolver resolver = new IRIResolver() ;
>> + N3IRIResolver resolver = new N3IRIResolver() ;
>> assertNotNull(resolver.getBaseIRI()) ;
>> String base = resolver.getBaseIRI() ;
>> assertTrue(base.indexOf(':') > 0 ) ;
>> @@ -42,7 +42,7 @@ public class TestResolver extends TestCase
>>
>> public void testBase2()
>> {
>> - IRIResolver resolver = new IRIResolver("x") ;
>> + N3IRIResolver resolver = new N3IRIResolver("x") ;
>> assertNotNull(resolver.getBaseIRI()) ;
>> // Active when IRI library integrated - currently the resolver
>> takes a raw base string.
>> // String base = resolver.getBaseIRI() ;
>> @@ -51,8 +51,8 @@ public class TestResolver extends TestCase
>>
>> public void testBase3()
>> {
>> - String b = IRIResolver.resolveGlobal("x") ;
>> - IRIResolver resolver = new IRIResolver(b) ;
>> + String b = N3IRIResolver.resolveGlobal("x") ;
>> + N3IRIResolver resolver = new N3IRIResolver(b) ;
>> assertNotNull(resolver.getBaseIRI()) ;
>> String base = resolver.getBaseIRI() ;
>> assertTrue(base.indexOf(':') > 0 ) ;
>> @@ -238,7 +238,7 @@ public class TestResolver extends TestCase
>>
>> private void execTest(String u, String base, String result)
>> {
>> - IRIResolver resolver = new IRIResolver(base) ;
>> + N3IRIResolver resolver = new N3IRIResolver(base) ;
>> String res = resolver.resolve(u) ;
>>
>> if (result == null )
>> @@ -254,7 +254,7 @@ public class TestResolver extends TestCase
>> // A test for resolved names that depend on where the tests are run.
>> private void execTestMatch(String u, String base, String
>> resultPattern)
>> {
>> - IRIResolver resolver = new IRIResolver(base) ;
>> + N3IRIResolver resolver = new N3IRIResolver(base) ;
>> String res = resolver.resolve(u) ;
>>
>> if (resultPattern == null )
>> @@ -269,14 +269,14 @@ public class TestResolver extends TestCase
>>
>> private void execFileTest(String fn1, String fn2)
>> {
>> - String s = IRIResolver.resolveFileURL(fn1) ;
>> + String s = N3IRIResolver.resolveFileURL(fn1) ;
>> assertEquals(s,fn2) ;
>> }
>>
>> private void execTestFileRelURI(String fn)
>> {
>> String relName = fn.substring("file:".length()) ;
>> - String s = IRIResolver.resolveFileURL(fn) ;
>> + String s = N3IRIResolver.resolveFileURL(fn) ;
>> assertTrue("Lost relative name: ("+fn+"=>"+s+")",
>> s.endsWith(relName) ) ;
>> assertTrue("Not absolute: ("+fn+"=>"+s+")",
>> s.startsWith("file:///") ) ;
>> }
>> @@ -285,7 +285,7 @@ public class TestResolver extends TestCase
>> {
>> String s = ex.getSimpleName() ;
>> try {
>> - IRIResolver resolver = new IRIResolver(base) ;
>> + N3IRIResolver resolver = new N3IRIResolver(base) ;
>> String res = resolver.resolve(u) ;
>> if ( res == null )
>> fail("("+u+","+base+") => <null> :: Expected exception: "
>> +s) ;
>> @@ -301,7 +301,7 @@ public class TestResolver extends TestCase
>> {
>> String s = ex.getSimpleName() ;
>> try {
>> - new IRIResolver(base) ;
>> + new N3IRIResolver(base) ;
>> fail("("+base+") => OK :: Expected exception: " +s) ;
>> } catch (Exception ex2)
>> {
>> @@ -312,14 +312,14 @@ public class TestResolver extends TestCase
>> private void choose(String base)
>> {
>>
>> - IRIResolver.chooseBaseURI(base) ;
>> + N3IRIResolver.chooseBaseURI(base) ;
>>
>> }
>> private void chooseException(String base, Class<?> ex)
>> {
>> String s = ex.getSimpleName() ;
>> try {
>> - IRIResolver.chooseBaseURI(base) ;
>> + N3IRIResolver.chooseBaseURI(base) ;
>> fail("("+base+") => OK :: Expected exception: " +s) ;
>> } catch (Exception ex2)
>> {
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
>> b/jena-core/src/test/java/org/apache/jena/rdf/model/test/
>> TestModelRead.java
>> index c4a7e26..4551fee 100644
>> --- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/
>> TestModelRead.java
>> +++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/
>> TestModelRead.java
>> @@ -69,7 +69,7 @@ public class TestModelRead extends AbstractModelTestBase
>> @SuppressWarnings("deprecation")
>> public void testSimpleLoadImplictBase() throws IRIException {
>> final Model mBasedImplicit = createModel() ;
>> - String fn=org.apache.jena.n3.IRIResolver.resolveGlobal(
>> getFileName("modelReading/based.n3"));
>> + String fn=org.apache.jena.n3.N3IRIResolver.resolveGlobal(
>> getFileName("modelReading/based.n3"));
>> final Model wanted = createModel().add(ModelHelper.resource(fn),
>> ModelHelper.property("ja:predicate"),
>> ModelHelper.resource("ja:object"))
>> ;
>> mBasedImplicit.read(fn, "N3") ;
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/test/java/org/apache/jena/testing_framework/
>> manifest/Manifest.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java
>> b/jena-core/src/test/java/org/apache/jena/testing_framework/
>> manifest/Manifest.java
>> index 9ff4354..af2259a 100644
>> --- a/jena-core/src/test/java/org/apache/jena/testing_framework/
>> manifest/Manifest.java
>> +++ b/jena-core/src/test/java/org/apache/jena/testing_framework/
>> manifest/Manifest.java
>> @@ -23,7 +23,7 @@ import java.util.Collection ;
>> import java.util.Iterator ;
>> import java.util.List ;
>>
>> -import org.apache.jena.n3.IRIResolver ;
>> +import org.apache.jena.n3.N3IRIResolver ;
>> import org.apache.jena.rdf.model.* ;
>> import org.apache.jena.util.FileManager ;
>> import org.apache.jena.vocabulary.RDF ;
>> @@ -49,7 +49,7 @@ public class Manifest {
>>
>> public Manifest(String fn) {
>> log.debug("Manifest = " + fn);
>> - filename = IRIResolver.resolveGlobal(fn);
>> + filename = N3IRIResolver.resolveGlobal(fn);
>> log.debug(" = " + filename);
>> manifest = FileManager.get().loadModel(filename);
>> parseIncludes();
>>
>> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
>> jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
>> ----------------------------------------------------------------------
>> diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
>> b/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
>> index e76d3f5..49362cd 100644
>> --- a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
>> +++ b/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
>> @@ -50,7 +50,7 @@ public class Manifest
>> public Manifest(String fn)
>> {
>> log.debug("Manifest = "+fn ) ;
>> - filename = org.apache.jena.n3.IRIResolver.resolveGlobal(fn) ;
>> + filename = org.apache.jena.n3.N3IRIResolver.resolveGlobal(fn) ;
>> log.debug(" = "+filename ) ;
>> manifest = FileManager.get().loadModel(filename) ;
>> parseIncludes() ;
>>
>>
>
>
Re: jena git commit: Rename old, deprecated IRIResolver as
N3IRIResolver to avoid name clash
Posted by Claude Warren <cl...@xenei.com>.
it might make sense to change
.../jena/rdf/model/test/TestModelRead.java
to use the new IRIResolver. I think the test code is just using it to
resolve file names.
Claude
On Mon, Oct 10, 2016 at 12:03 PM, <an...@apache.org> wrote:
> Repository: jena
> Updated Branches:
> refs/heads/master b15ca3b93 -> 1bcb9d20d
>
>
> Rename old, deprecated IRIResolver as N3IRIResolver to avoid name clash
>
> Project: http://git-wip-us.apache.org/repos/asf/jena/repo
> Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/1bcb9d20
> Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/1bcb9d20
> Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/1bcb9d20
>
> Branch: refs/heads/master
> Commit: 1bcb9d20dab9c0ed0728735fb74925f1804c90d4
> Parents: b15ca3b
> Author: Andy Seaborne <an...@apache.org>
> Authored: Mon Oct 10 12:02:38 2016 +0100
> Committer: Andy Seaborne <an...@apache.org>
> Committed: Mon Oct 10 12:02:38 2016 +0100
>
> ----------------------------------------------------------------------
> .../java/org/apache/jena/n3/IRIResolver.java | 231 -------------------
> .../java/org/apache/jena/n3/JenaReaderBase.java | 2 +-
> .../java/org/apache/jena/n3/N3IRIResolver.java | 231 +++++++++++++++++++
> .../org/apache/jena/n3/turtle/ParserBase.java | 6 +-
> .../java/org/apache/jena/n3/TestResolver.java | 26 +--
> .../jena/rdf/model/test/TestModelRead.java | 2 +-
> .../testing_framework/manifest/Manifest.java | 4 +-
> .../org/apache/jena/util/junit/Manifest.java | 2 +-
> 8 files changed, 252 insertions(+), 252 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
> b/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
> deleted file mode 100644
> index 268634b..0000000
> --- a/jena-core/src/main/java/org/apache/jena/n3/IRIResolver.java
> +++ /dev/null
> @@ -1,231 +0,0 @@
> -/*
> - * Licensed to the Apache Software Foundation (ASF) under one
> - * or more contributor license agreements. See the NOTICE file
> - * distributed with this work for additional information
> - * regarding copyright ownership. The ASF licenses this file
> - * to you under the Apache License, Version 2.0 (the
> - * "License"); you may not use this file except in compliance
> - * with the License. You may obtain a copy of the License at
> - *
> - * http://www.apache.org/licenses/LICENSE-2.0
> - *
> - * Unless required by applicable law or agreed to in writing, software
> - * distributed under the License is distributed on an "AS IS" BASIS,
> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> - * See the License for the specific language governing permissions and
> - * limitations under the License.
> - */
> -
> -package org.apache.jena.n3;
> -
> -
> -import org.apache.jena.iri.IRI;
> -import org.apache.jena.iri.IRIException;
> -import org.apache.jena.iri.IRIFactory;
> -import org.apache.jena.util.FileUtils ;
> -
> -/** A simple class to access IRI resolution.
> - * Replaced by {@code org.apache.jena.riot.system.IRIResolver}
> - */
> -
> -@Deprecated
> -public class IRIResolver {
> - /**
> - * The current working directory, as a string.
> - */
> - static private String globalBase = "http://localhost/
> LocalHostBase/" ;
> -
> - // Try to set the global base from the current directory.
> - // Security (e.g. Tomcat) may prevent this in which case we
> - // use a common default set above.
> - static {
> - try { globalBase = FileUtils.toURL("."); }
> - catch (Throwable th) { }
> - }
> -
> - /**
> - * The current working directory, as an IRI.
> - */
> - static final IRI cwd;
> -
> - /**
> - * An IRIFactory appropriately configuired.
> - */
> - static final IRIFactory factory = new IRIFactory(IRIFactory
> - .jenaImplementation());
> - static {
> - factory.setSameSchemeRelativeReferences("file");
> - }
> -
> - static {
> -
> - IRI cwdx;
> - try {
> - cwdx = factory.construct(globalBase);
> - } catch (IRIException e) {
> - System.err.println("Unexpected IRIException in
> initializer: "
> - + e.getMessage());
> - cwdx = factory.create("file:///");
> - }
> - cwd = cwdx;
> - }
> -
> -
> -
> - /**
> - * Turn a filename into a well-formed file: URL relative to the
> working
> - * directory.
> - *
> - * @param filename
> - * @return String The filename as an absolute URL
> - */
> - static public String resolveFileURL(String filename) throws
> IRIException {
> - IRI r = cwd.resolve(filename);
> - if (!r.getScheme().equalsIgnoreCase("file")) {
> - return resolveFileURL("./" + filename);
> - }
> - return r.toString();
> - }
> -
> - /**
> - * Create resolve a URI against a base. If baseStr is a relative
> file IRI
> - * then it is first resolved against the current working directory.
> - *
> - * @param relStr
> - * @param baseStr
> - * Can be null if relStr is absolute
> - * @return String An absolute URI
> - * @throws JenaURIException
> - * If result would not be legal, absolute IRI
> - */
> - static public String resolve(String relStr, String baseStr)
> - throws JenaURIException {
> - return exceptions(resolveIRI(relStr, baseStr)).toString();
> - }
> -
> - /*
> - * No exception thrown by this method.
> - */
> - static private IRI resolveIRI(String relStr, String baseStr) {
> - IRI i = factory.create(relStr);
> - if (i.isAbsolute())
> - // removes excess . segments
> - return cwd.create(i);
> -
> - IRI base = factory.create(baseStr);
> -
> - if ("file".equalsIgnoreCase(base.getScheme()))
> - return cwd.create(base).create(i);
> - return base.create(i);
> - }
> -
> - final private IRI base;
> -
> - /**
> - * Construct an IRIResolver with base as the
> - * current working directory.
> - *
> - */
> - public IRIResolver() {
> - this(null);
> - }
> -
> - /**
> - * Construct an IRIResolver with base determined
> - * by the argument URI. If this is relative,
> - * it is relative against the current working directory.
> - * @param baseS
> - *
> - * @throws JenaURIException
> - * If resulting base would not be legal, absolute IRI
> - */
> - public IRIResolver(String baseS) {
> - if (baseS == null)
> - baseS = chooseBaseURI();
> - // IRI aaa = RelURI.factory.construct(baseS);
> - base = exceptions(cwd.create(baseS));
> - }
> -
> - /**
> - * The base of this IRIResolver.
> - * @return String
> - */
> - public String getBaseIRI() {
> - return base.toString();
> - }
> -
> - /**
> - * Resolve the relative URI against the base of
> - * this IRIResolver.
> - * @param relURI
> - * @return the resolved IRI
> - * @throws JenaURIException
> - * If resulting URI would not be legal, absolute IRI
> -
> - */
> - public String resolve(String relURI) {
> - return exceptions(base.resolve(relURI)).toString();
> - }
> -
> -
> - /**
> - * Throw any exceptions resulting from IRI.
> - * @param iri
> - * @return iri
> - */
> - static private IRI exceptions(IRI iri) {
> - if (showExceptions && iri.hasViolation(false)) {
> - try {
> - cwd.construct(iri);
> - } catch (IRIException e) {
> - throw new JenaURIException(e);
> - }
> - }
> - return iri;
> - }
> -
> - private static boolean showExceptions = true;
> -
> - /**
> - To allow Eyeball to bypass IRI checking (because it's doing
> its own)
> - */
> - public static void suppressExceptions()
> - { setShowExceptions(false) ; }
> -
> - /** To allow Eyeball to bypass IRI checking (because it's doing
> its own) */
> - public static void setShowExceptions(boolean state)
> - { showExceptions = state ; }
> -
> -/**
> - * Resolve the relative URI str against the current
> - * working directory.
> - * @param str
> - * @return String
> - */
> - public static String resolveGlobal(String str) {
> - return exceptions(cwd.resolve(str)).toString();
> - }
> -
> - /**
> - * Choose a base URI based on the current directory
> - *
> - * @return String Absolute URI
> - */
> -
> - static public String chooseBaseURI() {
> - return chooseBaseURI(null);
> - }
> -
> - /**
> - * Choose a baseURI based on a suggestion
> - *
> - * @return String URI (if relative, relative to current working
> directory).
> - */
> -
> - static public String chooseBaseURI(String baseURI) {
> - if (baseURI == null)
> - baseURI = "file:.";
> - return resolveGlobal(baseURI);
> - }
> -
> -}
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
> b/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
> index dff0c55..2e386c8 100644
> --- a/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
> +++ b/jena-core/src/main/java/org/apache/jena/n3/JenaReaderBase.java
> @@ -110,7 +110,7 @@ public abstract class JenaReaderBase implements
> RDFReader
> // The reader has been checked, if possible, by now or
> // constructed correctly by code here.
> if ( base != null )
> - base = IRIResolver.resolveGlobal(base) ;
> + base = N3IRIResolver.resolveGlobal(base) ;
> try {
> model.notifyEvent( GraphEvents.startRead );
> readWorker(model, reader, base) ;
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
> b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
> new file mode 100644
> index 0000000..f8ba6de
> --- /dev/null
> +++ b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
> @@ -0,0 +1,231 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the License for the specific language governing permissions and
> + * limitations under the License.
> + */
> +
> +package org.apache.jena.n3;
> +
> +
> +import org.apache.jena.iri.IRI;
> +import org.apache.jena.iri.IRIException;
> +import org.apache.jena.iri.IRIFactory;
> +import org.apache.jena.util.FileUtils ;
> +
> +/** A simple class to access IRI resolution.
> + * Replaced by {@code org.apache.jena.riot.system.IRIResolver}
> + */
> +
> +@Deprecated
> +public class N3IRIResolver {
> + /**
> + * The current working directory, as a string.
> + */
> + static private String globalBase = "http://localhost/
> LocalHostBase/" ;
> +
> + // Try to set the global base from the current directory.
> + // Security (e.g. Tomcat) may prevent this in which case we
> + // use a common default set above.
> + static {
> + try { globalBase = FileUtils.toURL("."); }
> + catch (Throwable th) { }
> + }
> +
> + /**
> + * The current working directory, as an IRI.
> + */
> + static final IRI cwd;
> +
> + /**
> + * An IRIFactory appropriately configuired.
> + */
> + static final IRIFactory factory = new IRIFactory(IRIFactory
> + .jenaImplementation());
> + static {
> + factory.setSameSchemeRelativeReferences("file");
> + }
> +
> + static {
> +
> + IRI cwdx;
> + try {
> + cwdx = factory.construct(globalBase);
> + } catch (IRIException e) {
> + System.err.println("Unexpected IRIException in
> initializer: "
> + + e.getMessage());
> + cwdx = factory.create("file:///");
> + }
> + cwd = cwdx;
> + }
> +
> +
> +
> + /**
> + * Turn a filename into a well-formed file: URL relative to the
> working
> + * directory.
> + *
> + * @param filename
> + * @return String The filename as an absolute URL
> + */
> + static public String resolveFileURL(String filename) throws
> IRIException {
> + IRI r = cwd.resolve(filename);
> + if (!r.getScheme().equalsIgnoreCase("file")) {
> + return resolveFileURL("./" + filename);
> + }
> + return r.toString();
> + }
> +
> + /**
> + * Create resolve a URI against a base. If baseStr is a relative
> file IRI
> + * then it is first resolved against the current working directory.
> + *
> + * @param relStr
> + * @param baseStr
> + * Can be null if relStr is absolute
> + * @return String An absolute URI
> + * @throws JenaURIException
> + * If result would not be legal, absolute IRI
> + */
> + static public String resolve(String relStr, String baseStr)
> + throws JenaURIException {
> + return exceptions(resolveIRI(relStr, baseStr)).toString();
> + }
> +
> + /*
> + * No exception thrown by this method.
> + */
> + static private IRI resolveIRI(String relStr, String baseStr) {
> + IRI i = factory.create(relStr);
> + if (i.isAbsolute())
> + // removes excess . segments
> + return cwd.create(i);
> +
> + IRI base = factory.create(baseStr);
> +
> + if ("file".equalsIgnoreCase(base.getScheme()))
> + return cwd.create(base).create(i);
> + return base.create(i);
> + }
> +
> + final private IRI base;
> +
> + /**
> + * Construct an IRIResolver with base as the
> + * current working directory.
> + *
> + */
> + public N3IRIResolver() {
> + this(null);
> + }
> +
> + /**
> + * Construct an IRIResolver with base determined
> + * by the argument URI. If this is relative,
> + * it is relative against the current working directory.
> + * @param baseS
> + *
> + * @throws JenaURIException
> + * If resulting base would not be legal, absolute IRI
> + */
> + public N3IRIResolver(String baseS) {
> + if (baseS == null)
> + baseS = chooseBaseURI();
> + // IRI aaa = RelURI.factory.construct(baseS);
> + base = exceptions(cwd.create(baseS));
> + }
> +
> + /**
> + * The base of this IRIResolver.
> + * @return String
> + */
> + public String getBaseIRI() {
> + return base.toString();
> + }
> +
> + /**
> + * Resolve the relative URI against the base of
> + * this IRIResolver.
> + * @param relURI
> + * @return the resolved IRI
> + * @throws JenaURIException
> + * If resulting URI would not be legal, absolute IRI
> +
> + */
> + public String resolve(String relURI) {
> + return exceptions(base.resolve(relURI)).toString();
> + }
> +
> +
> + /**
> + * Throw any exceptions resulting from IRI.
> + * @param iri
> + * @return iri
> + */
> + static private IRI exceptions(IRI iri) {
> + if (showExceptions && iri.hasViolation(false)) {
> + try {
> + cwd.construct(iri);
> + } catch (IRIException e) {
> + throw new JenaURIException(e);
> + }
> + }
> + return iri;
> + }
> +
> + private static boolean showExceptions = true;
> +
> + /**
> + To allow Eyeball to bypass IRI checking (because it's doing
> its own)
> + */
> + public static void suppressExceptions()
> + { setShowExceptions(false) ; }
> +
> + /** To allow Eyeball to bypass IRI checking (because it's doing
> its own) */
> + public static void setShowExceptions(boolean state)
> + { showExceptions = state ; }
> +
> +/**
> + * Resolve the relative URI str against the current
> + * working directory.
> + * @param str
> + * @return String
> + */
> + public static String resolveGlobal(String str) {
> + return exceptions(cwd.resolve(str)).toString();
> + }
> +
> + /**
> + * Choose a base URI based on the current directory
> + *
> + * @return String Absolute URI
> + */
> +
> + static public String chooseBaseURI() {
> + return chooseBaseURI(null);
> + }
> +
> + /**
> + * Choose a baseURI based on a suggestion
> + *
> + * @return String URI (if relative, relative to current working
> directory).
> + */
> +
> + static public String chooseBaseURI(String baseURI) {
> + if (baseURI == null)
> + baseURI = "file:.";
> + return resolveGlobal(baseURI);
> + }
> +
> +}
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
> b/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
> index bd581a5..197e231 100644
> --- a/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
> +++ b/jena-core/src/main/java/org/apache/jena/n3/turtle/ParserBase.java
> @@ -24,7 +24,7 @@ import org.apache.jena.datatypes.xsd.XSDDatatype ;
> import org.apache.jena.graph.Node ;
> import org.apache.jena.graph.NodeFactory ;
> import org.apache.jena.graph.Triple ;
> -import org.apache.jena.n3.IRIResolver ;
> +import org.apache.jena.n3.N3IRIResolver ;
> import org.apache.jena.n3.JenaURIException ;
> import org.apache.jena.shared.PrefixMapping ;
> import org.apache.jena.shared.impl.PrefixMappingImpl ;
> @@ -59,12 +59,12 @@ public class ParserBase
> public ParserBase() {}
>
> PrefixMapping prefixMapping = new PrefixMappingImpl() ;
> - IRIResolver resolver = new IRIResolver() ;
> + N3IRIResolver resolver = new N3IRIResolver() ;
>
> protected String getBaseURI() { return resolver.getBaseIRI() ; }
> public void setBaseURI(String u)
> {
> - resolver = new IRIResolver(u) ;
> + resolver = new N3IRIResolver(u) ;
> }
>
> protected void setBase(String iriStr , int line, int column)
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
> b/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
> index 13a348e..832a4b7 100644
> --- a/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
> +++ b/jena-core/src/test/java/org/apache/jena/n3/TestResolver.java
> @@ -20,7 +20,7 @@ package org.apache.jena.n3;
>
> import junit.framework.TestCase;
> import junit.framework.TestSuite;
> -import org.apache.jena.n3.IRIResolver ;
> +import org.apache.jena.n3.N3IRIResolver ;
> import org.apache.jena.n3.JenaURIException ;
> @SuppressWarnings("deprecation")
> public class TestResolver extends TestCase
> @@ -34,7 +34,7 @@ public class TestResolver extends TestCase
>
> public void testBase1()
> {
> - IRIResolver resolver = new IRIResolver() ;
> + N3IRIResolver resolver = new N3IRIResolver() ;
> assertNotNull(resolver.getBaseIRI()) ;
> String base = resolver.getBaseIRI() ;
> assertTrue(base.indexOf(':') > 0 ) ;
> @@ -42,7 +42,7 @@ public class TestResolver extends TestCase
>
> public void testBase2()
> {
> - IRIResolver resolver = new IRIResolver("x") ;
> + N3IRIResolver resolver = new N3IRIResolver("x") ;
> assertNotNull(resolver.getBaseIRI()) ;
> // Active when IRI library integrated - currently the resolver
> takes a raw base string.
> // String base = resolver.getBaseIRI() ;
> @@ -51,8 +51,8 @@ public class TestResolver extends TestCase
>
> public void testBase3()
> {
> - String b = IRIResolver.resolveGlobal("x") ;
> - IRIResolver resolver = new IRIResolver(b) ;
> + String b = N3IRIResolver.resolveGlobal("x") ;
> + N3IRIResolver resolver = new N3IRIResolver(b) ;
> assertNotNull(resolver.getBaseIRI()) ;
> String base = resolver.getBaseIRI() ;
> assertTrue(base.indexOf(':') > 0 ) ;
> @@ -238,7 +238,7 @@ public class TestResolver extends TestCase
>
> private void execTest(String u, String base, String result)
> {
> - IRIResolver resolver = new IRIResolver(base) ;
> + N3IRIResolver resolver = new N3IRIResolver(base) ;
> String res = resolver.resolve(u) ;
>
> if (result == null )
> @@ -254,7 +254,7 @@ public class TestResolver extends TestCase
> // A test for resolved names that depend on where the tests are run.
> private void execTestMatch(String u, String base, String
> resultPattern)
> {
> - IRIResolver resolver = new IRIResolver(base) ;
> + N3IRIResolver resolver = new N3IRIResolver(base) ;
> String res = resolver.resolve(u) ;
>
> if (resultPattern == null )
> @@ -269,14 +269,14 @@ public class TestResolver extends TestCase
>
> private void execFileTest(String fn1, String fn2)
> {
> - String s = IRIResolver.resolveFileURL(fn1) ;
> + String s = N3IRIResolver.resolveFileURL(fn1) ;
> assertEquals(s,fn2) ;
> }
>
> private void execTestFileRelURI(String fn)
> {
> String relName = fn.substring("file:".length()) ;
> - String s = IRIResolver.resolveFileURL(fn) ;
> + String s = N3IRIResolver.resolveFileURL(fn) ;
> assertTrue("Lost relative name: ("+fn+"=>"+s+")",
> s.endsWith(relName) ) ;
> assertTrue("Not absolute: ("+fn+"=>"+s+")",
> s.startsWith("file:///") ) ;
> }
> @@ -285,7 +285,7 @@ public class TestResolver extends TestCase
> {
> String s = ex.getSimpleName() ;
> try {
> - IRIResolver resolver = new IRIResolver(base) ;
> + N3IRIResolver resolver = new N3IRIResolver(base) ;
> String res = resolver.resolve(u) ;
> if ( res == null )
> fail("("+u+","+base+") => <null> :: Expected exception: "
> +s) ;
> @@ -301,7 +301,7 @@ public class TestResolver extends TestCase
> {
> String s = ex.getSimpleName() ;
> try {
> - new IRIResolver(base) ;
> + new N3IRIResolver(base) ;
> fail("("+base+") => OK :: Expected exception: " +s) ;
> } catch (Exception ex2)
> {
> @@ -312,14 +312,14 @@ public class TestResolver extends TestCase
> private void choose(String base)
> {
>
> - IRIResolver.chooseBaseURI(base) ;
> + N3IRIResolver.chooseBaseURI(base) ;
>
> }
> private void chooseException(String base, Class<?> ex)
> {
> String s = ex.getSimpleName() ;
> try {
> - IRIResolver.chooseBaseURI(base) ;
> + N3IRIResolver.chooseBaseURI(base) ;
> fail("("+base+") => OK :: Expected exception: " +s) ;
> } catch (Exception ex2)
> {
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/test/java/org/apache/jena/rdf/model/test/TestModelRead.java
> b/jena-core/src/test/java/org/apache/jena/rdf/model/test/
> TestModelRead.java
> index c4a7e26..4551fee 100644
> --- a/jena-core/src/test/java/org/apache/jena/rdf/model/test/
> TestModelRead.java
> +++ b/jena-core/src/test/java/org/apache/jena/rdf/model/test/
> TestModelRead.java
> @@ -69,7 +69,7 @@ public class TestModelRead extends AbstractModelTestBase
> @SuppressWarnings("deprecation")
> public void testSimpleLoadImplictBase() throws IRIException {
> final Model mBasedImplicit = createModel() ;
> - String fn=org.apache.jena.n3.IRIResolver.resolveGlobal(
> getFileName("modelReading/based.n3"));
> + String fn=org.apache.jena.n3.N3IRIResolver.resolveGlobal(
> getFileName("modelReading/based.n3"));
> final Model wanted = createModel().add(ModelHelper.resource(fn),
> ModelHelper.property("ja:predicate"),
> ModelHelper.resource("ja:object"))
> ;
> mBasedImplicit.read(fn, "N3") ;
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/test/java/org/apache/jena/testing_framework/
> manifest/Manifest.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/test/java/org/apache/jena/testing_framework/manifest/Manifest.java
> b/jena-core/src/test/java/org/apache/jena/testing_framework/
> manifest/Manifest.java
> index 9ff4354..af2259a 100644
> --- a/jena-core/src/test/java/org/apache/jena/testing_framework/
> manifest/Manifest.java
> +++ b/jena-core/src/test/java/org/apache/jena/testing_framework/
> manifest/Manifest.java
> @@ -23,7 +23,7 @@ import java.util.Collection ;
> import java.util.Iterator ;
> import java.util.List ;
>
> -import org.apache.jena.n3.IRIResolver ;
> +import org.apache.jena.n3.N3IRIResolver ;
> import org.apache.jena.rdf.model.* ;
> import org.apache.jena.util.FileManager ;
> import org.apache.jena.vocabulary.RDF ;
> @@ -49,7 +49,7 @@ public class Manifest {
>
> public Manifest(String fn) {
> log.debug("Manifest = " + fn);
> - filename = IRIResolver.resolveGlobal(fn);
> + filename = N3IRIResolver.resolveGlobal(fn);
> log.debug(" = " + filename);
> manifest = FileManager.get().loadModel(filename);
> parseIncludes();
>
> http://git-wip-us.apache.org/repos/asf/jena/blob/1bcb9d20/
> jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
> ----------------------------------------------------------------------
> diff --git a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
> b/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
> index e76d3f5..49362cd 100644
> --- a/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
> +++ b/jena-core/src/test/java/org/apache/jena/util/junit/Manifest.java
> @@ -50,7 +50,7 @@ public class Manifest
> public Manifest(String fn)
> {
> log.debug("Manifest = "+fn ) ;
> - filename = org.apache.jena.n3.IRIResolver.resolveGlobal(fn) ;
> + filename = org.apache.jena.n3.N3IRIResolver.resolveGlobal(fn) ;
> log.debug(" = "+filename ) ;
> manifest = FileManager.get().loadModel(filename) ;
> parseIncludes() ;
>
>
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren