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 2018/01/15 11:48:06 UTC
[01/10] jena git commit: Move to test source tree.
Repository: jena
Updated Branches:
refs/heads/master 58ac14b7e -> aa25db6c3
Move to test source tree.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ca760f74
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ca760f74
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ca760f74
Branch: refs/heads/master
Commit: ca760f74291f8bcd4f4f983a56c0e8b7e41dddb2
Parents: 58ac14b
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:12:26 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:12:26 2018 +0000
----------------------------------------------------------------------
.../jena/shared/wg/LazyFileInputStream.java | 46 -----
.../apache/jena/shared/wg/LazyInputStream.java | 62 ------
.../jena/shared/wg/LazyURLInputStream.java | 50 -----
.../jena/shared/wg/LazyZipEntryInputStream.java | 52 -----
.../jena/shared/wg/TestInputStreamFactory.java | 192 -------------------
.../java/org/apache/jena/shared/wg/package.html | 30 ---
.../jena/shared/wg/InputStreamFactoryTests.java | 192 +++++++++++++++++++
.../jena/shared/wg/LazyFileInputStream.java | 46 +++++
.../apache/jena/shared/wg/LazyInputStream.java | 62 ++++++
.../jena/shared/wg/LazyURLInputStream.java | 50 +++++
.../jena/shared/wg/LazyZipEntryInputStream.java | 52 +++++
.../java/org/apache/jena/shared/wg/package.html | 30 +++
12 files changed, 432 insertions(+), 432 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/main/java/org/apache/jena/shared/wg/LazyFileInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyFileInputStream.java b/jena-core/src/main/java/org/apache/jena/shared/wg/LazyFileInputStream.java
deleted file mode 100644
index dd69cab..0000000
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyFileInputStream.java
+++ /dev/null
@@ -1,46 +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.shared.wg;
-
-
-import java.io.*;
-
-/**
- *
- * In test cases we cannot open all the input files
- * while creating the test suite, but must defer the
- * opening until the test is actually run.
- */
-class LazyFileInputStream extends LazyInputStream {
-
- private String name;
- /** Creates new LazyZipEntryInputStream */
- LazyFileInputStream(String name) {
- // System.err.println(name);
- this.name = name;
- }
-
- @Override
- InputStream open() throws IOException {
- return new FileInputStream(name);
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/main/java/org/apache/jena/shared/wg/LazyInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyInputStream.java b/jena-core/src/main/java/org/apache/jena/shared/wg/LazyInputStream.java
deleted file mode 100644
index 1019127..0000000
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyInputStream.java
+++ /dev/null
@@ -1,62 +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.shared.wg;
-
-
-import java.io.*;
-
-/**
- *In test cases we cannot open all the input files
- * while creating the test suite, but must defer the
- * opening until the test is actually run.
- */
-abstract class LazyInputStream extends InputStream {
-
- private InputStream underlying;
- abstract InputStream open() throws IOException;
-
- boolean connect() throws IOException {
- if ( underlying != null )
- return true;
- else {
- underlying = open();
- }
- return underlying != null;
-
- }
-
-
- @Override
- public int read() throws IOException {
- if (underlying == null)
- underlying = open();
- return underlying.read();
- }
-
- @Override
- public void close() throws IOException {
- if (underlying != null) {
- underlying.close();
- underlying = null;
- }
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/main/java/org/apache/jena/shared/wg/LazyURLInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyURLInputStream.java b/jena-core/src/main/java/org/apache/jena/shared/wg/LazyURLInputStream.java
deleted file mode 100644
index 43e5bbd..0000000
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyURLInputStream.java
+++ /dev/null
@@ -1,50 +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.shared.wg;
-
-
-import java.io.*;
-import java.net.*;
-
-/**
- *
- * In test cases we cannot open all the input files
- * while creating the test suite, but must defer the
- * opening until the test is actually run.
- */
-class LazyURLInputStream extends LazyInputStream {
-
- private URL url;
- /** Creates new LazyZipEntryInputStream */
- LazyURLInputStream(URL url) {
- // System.err.println(name);
- this.url = url;
- }
-
- @Override
- InputStream open() throws IOException {
- URLConnection conn = url.openConnection();
- // System.err.println(conn.getClass().getName());
-
- return conn.getInputStream();
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/main/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java b/jena-core/src/main/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java
deleted file mode 100644
index 4e1a927..0000000
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java
+++ /dev/null
@@ -1,52 +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.shared.wg;
-
-
-import java.io.*;
-import java.util.zip.*;
-
-/**
- *In test cases we cannot open all the input files
- * while creating the test suite, but must defer the
- * opening until the test is actually run.
- */
-class LazyZipEntryInputStream extends LazyInputStream {
-
- private ZipEntry entry;
- private ZipFile zip;
- /** Creates new LazyZipEntryInputStream */
- LazyZipEntryInputStream(ZipFile zip,String name) {
- // System.err.println(name);
- entry = new ZipEntry(name);
- this.zip = zip;
- }
-
-
- @Override
- InputStream open() throws IOException {
- InputStream rslt = zip.getInputStream(entry);
- if ( rslt == null )
- throw new IllegalArgumentException(entry.getName()+ " cannot be opened.");
- return rslt;
- }
-
-
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/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
deleted file mode 100644
index 0375eec..0000000
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/TestInputStreamFactory.java
+++ /dev/null
@@ -1,192 +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.shared.wg;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.zip.ZipFile;
-
-import org.apache.jena.iri.*;
-import org.apache.jena.shared.JenaException ;
-
-/**
- * This class provides input streams that:
- * 1: can be from a URL or from a zip
- * 2: do not actually open until the first read
- */
-public class TestInputStreamFactory {
- @SuppressWarnings("deprecation")
- final IRIFactory iriFactory = IRIFactory.jenaImplementation();
-
- final private IRI base;
- final private IRI mapBase;
- final private ZipFile zip;
- final private String property;
- private String createMe = "error";
-
- /** @param baseDir A prefix of all URLs accessed through this factory.
- * @param getBaseDir Replace the baseDir into getBaseDir before opening any URL.
- */
- public TestInputStreamFactory(IRI baseDir, IRI getBaseDir) {
- base = baseDir;
- mapBase = getBaseDir;
- zip = null;
- property = null;
- }
- /** @param baseDir A prefix of all URLs accessed through this factory.
- * @param zip To open a URL remove the baseDir from the URL and get the named file from the zip.
- */
- public TestInputStreamFactory(IRI baseDir, ZipFile zip) {
- base = baseDir;
- mapBase = null;
- this.zip = zip;
- property = null;
- }
-
- public TestInputStreamFactory(IRI baseDir, String propDir) {
- createMe = "new TestInputStreamFactory(URI.create(\""+baseDir.toString()
- +"\"),\""+propDir+"\")";
- base = baseDir;
- mapBase = null;
- this.zip = null;
- property = propDir.endsWith("/") ? propDir : propDir + "/";
- }
-
- public IRI getBase() {
- return base;
- }
- /**
- * A lazy open. The I/O only starts, and resources
- * are only allocated on first read.
- * @param str The URI to open
- */
- public InputStream open(String str) {
- return open(iriFactory.create(str));
- }
- /**
- * opens the file, and really does it - not a delayed
- * lazy opening.
- * @param str the URI to open
- * @return null on some failures
- * @throws IOException
- */
- public InputStream fullyOpen(String str) throws IOException {
- InputStream in = open(iriFactory.create(str));
- if (in instanceof LazyInputStream
- && !((LazyInputStream) in).connect())
- return null;
- return in;
- }
- /**
- * A lazy open. The I/O only starts, and resources
- * are only allocated on first read.
- * @param uri to be opened.
- * @return the opened stream
- */
- public InputStream open(IRI uri) {
- return (InputStream) open(uri, true);
-
- }
- public boolean savable() {
- return mapBase != null && mapBase.getScheme().equalsIgnoreCase("file");
-
- }
- public OutputStream openOutput(String str) {
- OutputStream foo = (OutputStream) open(iriFactory.create(str), false);
- // System.out.println(foo.toString());
- return foo;
- }
-
- public String getCreationJava() {
- return createMe;
- }
- private Object open(IRI uri, boolean in) {
-
- IRI relative = uri.isAbsolute() ? base.relativize(uri,
- IRIRelativize.CHILD) : uri;
-
- if (relative.isAbsolute())
- throw new IllegalArgumentException(
- "This TestInputStreamFactory only knows about '" + base + "'.");
-
- String relPath = relative.toString();
- if ( relPath.length() - relPath.lastIndexOf('.') > 5 ) {
- relPath = relPath + ".rdf";
- relative = iriFactory.create(relPath);
- }
-
- if (mapBase != null) {
- //System.out.println("LazyURL: " + relative + " " + mapBase);
- try {
- URL url = mapBase.create(relative).toURL();
- if (!in) {
- if (url.getProtocol().equalsIgnoreCase("file"))
- return new FileOutputStream(url.getFile());
- throw new IllegalArgumentException("Can only save to file: scheme");
- }
- return new LazyURLInputStream(url);
- } catch (MalformedURLException e) {
- throw new JenaException( e );
- } catch (IOException e) {
- e.printStackTrace();
- throw new JenaException( e );
- }
- }
- if (!in)
- throw new IllegalArgumentException("Can only save to URLs");
-
-
- if (zip != null)
- return new LazyZipEntryInputStream(zip,relPath );
- else
- return TestInputStreamFactory.getInputStream(property + relPath );
-
- }
-
- private static InputStream getInputStream(String prop) {
- // System.err.println(prop);
- ClassLoader loader = TestInputStreamFactory.class.getClassLoader();
- if (loader == null)
- throw new SecurityException("Cannot access class loader");
- InputStream in =
- // loader.getResourceAsStream("com/hp/hpl/jena/rdf/arp/test/data/" + prop);
- loader.getResourceAsStream("testing/" + prop);
- // System.out.println(prop);
- if (in == null) {
- try {
- in = new FileInputStream("testing/" + prop);
- } catch (IOException e) {
- }
- if (in == null)
- throw new IllegalArgumentException(
- "Resource: " + prop + " not found on class path.");
- }
-
- return in;
- }
- public IRI getMapBase() {
- return mapBase;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/main/java/org/apache/jena/shared/wg/package.html
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/shared/wg/package.html b/jena-core/src/main/java/org/apache/jena/shared/wg/package.html
deleted file mode 100644
index 8bd36a1..0000000
--- a/jena-core/src/main/java/org/apache/jena/shared/wg/package.html
+++ /dev/null
@@ -1,30 +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.
--->
-
-<html>
-<head>
-<title>shared.wg</title>
-</head>
-<body>
-This package defines some classes to help with accessing tests
-produced by the RDF Core and WebOnt WGs.
-The tests can be accessed either from the web,
-or from a zip on the web,
-from a local copy in the testing directory.
-</body>
-</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java b/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
new file mode 100644
index 0000000..0375eec
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
@@ -0,0 +1,192 @@
+/*
+ * 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.shared.wg;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.zip.ZipFile;
+
+import org.apache.jena.iri.*;
+import org.apache.jena.shared.JenaException ;
+
+/**
+ * This class provides input streams that:
+ * 1: can be from a URL or from a zip
+ * 2: do not actually open until the first read
+ */
+public class TestInputStreamFactory {
+ @SuppressWarnings("deprecation")
+ final IRIFactory iriFactory = IRIFactory.jenaImplementation();
+
+ final private IRI base;
+ final private IRI mapBase;
+ final private ZipFile zip;
+ final private String property;
+ private String createMe = "error";
+
+ /** @param baseDir A prefix of all URLs accessed through this factory.
+ * @param getBaseDir Replace the baseDir into getBaseDir before opening any URL.
+ */
+ public TestInputStreamFactory(IRI baseDir, IRI getBaseDir) {
+ base = baseDir;
+ mapBase = getBaseDir;
+ zip = null;
+ property = null;
+ }
+ /** @param baseDir A prefix of all URLs accessed through this factory.
+ * @param zip To open a URL remove the baseDir from the URL and get the named file from the zip.
+ */
+ public TestInputStreamFactory(IRI baseDir, ZipFile zip) {
+ base = baseDir;
+ mapBase = null;
+ this.zip = zip;
+ property = null;
+ }
+
+ public TestInputStreamFactory(IRI baseDir, String propDir) {
+ createMe = "new TestInputStreamFactory(URI.create(\""+baseDir.toString()
+ +"\"),\""+propDir+"\")";
+ base = baseDir;
+ mapBase = null;
+ this.zip = null;
+ property = propDir.endsWith("/") ? propDir : propDir + "/";
+ }
+
+ public IRI getBase() {
+ return base;
+ }
+ /**
+ * A lazy open. The I/O only starts, and resources
+ * are only allocated on first read.
+ * @param str The URI to open
+ */
+ public InputStream open(String str) {
+ return open(iriFactory.create(str));
+ }
+ /**
+ * opens the file, and really does it - not a delayed
+ * lazy opening.
+ * @param str the URI to open
+ * @return null on some failures
+ * @throws IOException
+ */
+ public InputStream fullyOpen(String str) throws IOException {
+ InputStream in = open(iriFactory.create(str));
+ if (in instanceof LazyInputStream
+ && !((LazyInputStream) in).connect())
+ return null;
+ return in;
+ }
+ /**
+ * A lazy open. The I/O only starts, and resources
+ * are only allocated on first read.
+ * @param uri to be opened.
+ * @return the opened stream
+ */
+ public InputStream open(IRI uri) {
+ return (InputStream) open(uri, true);
+
+ }
+ public boolean savable() {
+ return mapBase != null && mapBase.getScheme().equalsIgnoreCase("file");
+
+ }
+ public OutputStream openOutput(String str) {
+ OutputStream foo = (OutputStream) open(iriFactory.create(str), false);
+ // System.out.println(foo.toString());
+ return foo;
+ }
+
+ public String getCreationJava() {
+ return createMe;
+ }
+ private Object open(IRI uri, boolean in) {
+
+ IRI relative = uri.isAbsolute() ? base.relativize(uri,
+ IRIRelativize.CHILD) : uri;
+
+ if (relative.isAbsolute())
+ throw new IllegalArgumentException(
+ "This TestInputStreamFactory only knows about '" + base + "'.");
+
+ String relPath = relative.toString();
+ if ( relPath.length() - relPath.lastIndexOf('.') > 5 ) {
+ relPath = relPath + ".rdf";
+ relative = iriFactory.create(relPath);
+ }
+
+ if (mapBase != null) {
+ //System.out.println("LazyURL: " + relative + " " + mapBase);
+ try {
+ URL url = mapBase.create(relative).toURL();
+ if (!in) {
+ if (url.getProtocol().equalsIgnoreCase("file"))
+ return new FileOutputStream(url.getFile());
+ throw new IllegalArgumentException("Can only save to file: scheme");
+ }
+ return new LazyURLInputStream(url);
+ } catch (MalformedURLException e) {
+ throw new JenaException( e );
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new JenaException( e );
+ }
+ }
+ if (!in)
+ throw new IllegalArgumentException("Can only save to URLs");
+
+
+ if (zip != null)
+ return new LazyZipEntryInputStream(zip,relPath );
+ else
+ return TestInputStreamFactory.getInputStream(property + relPath );
+
+ }
+
+ private static InputStream getInputStream(String prop) {
+ // System.err.println(prop);
+ ClassLoader loader = TestInputStreamFactory.class.getClassLoader();
+ if (loader == null)
+ throw new SecurityException("Cannot access class loader");
+ InputStream in =
+ // loader.getResourceAsStream("com/hp/hpl/jena/rdf/arp/test/data/" + prop);
+ loader.getResourceAsStream("testing/" + prop);
+ // System.out.println(prop);
+ if (in == null) {
+ try {
+ in = new FileInputStream("testing/" + prop);
+ } catch (IOException e) {
+ }
+ if (in == null)
+ throw new IllegalArgumentException(
+ "Resource: " + prop + " not found on class path.");
+ }
+
+ return in;
+ }
+ public IRI getMapBase() {
+ return mapBase;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/test/java/org/apache/jena/shared/wg/LazyFileInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/LazyFileInputStream.java b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyFileInputStream.java
new file mode 100644
index 0000000..dd69cab
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyFileInputStream.java
@@ -0,0 +1,46 @@
+/*
+ * 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.shared.wg;
+
+
+import java.io.*;
+
+/**
+ *
+ * In test cases we cannot open all the input files
+ * while creating the test suite, but must defer the
+ * opening until the test is actually run.
+ */
+class LazyFileInputStream extends LazyInputStream {
+
+ private String name;
+ /** Creates new LazyZipEntryInputStream */
+ LazyFileInputStream(String name) {
+ // System.err.println(name);
+ this.name = name;
+ }
+
+ @Override
+ InputStream open() throws IOException {
+ return new FileInputStream(name);
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/test/java/org/apache/jena/shared/wg/LazyInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/LazyInputStream.java b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyInputStream.java
new file mode 100644
index 0000000..1019127
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyInputStream.java
@@ -0,0 +1,62 @@
+/*
+ * 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.shared.wg;
+
+
+import java.io.*;
+
+/**
+ *In test cases we cannot open all the input files
+ * while creating the test suite, but must defer the
+ * opening until the test is actually run.
+ */
+abstract class LazyInputStream extends InputStream {
+
+ private InputStream underlying;
+ abstract InputStream open() throws IOException;
+
+ boolean connect() throws IOException {
+ if ( underlying != null )
+ return true;
+ else {
+ underlying = open();
+ }
+ return underlying != null;
+
+ }
+
+
+ @Override
+ public int read() throws IOException {
+ if (underlying == null)
+ underlying = open();
+ return underlying.read();
+ }
+
+ @Override
+ public void close() throws IOException {
+ if (underlying != null) {
+ underlying.close();
+ underlying = null;
+ }
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/test/java/org/apache/jena/shared/wg/LazyURLInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/LazyURLInputStream.java b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyURLInputStream.java
new file mode 100644
index 0000000..43e5bbd
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyURLInputStream.java
@@ -0,0 +1,50 @@
+/*
+ * 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.shared.wg;
+
+
+import java.io.*;
+import java.net.*;
+
+/**
+ *
+ * In test cases we cannot open all the input files
+ * while creating the test suite, but must defer the
+ * opening until the test is actually run.
+ */
+class LazyURLInputStream extends LazyInputStream {
+
+ private URL url;
+ /** Creates new LazyZipEntryInputStream */
+ LazyURLInputStream(URL url) {
+ // System.err.println(name);
+ this.url = url;
+ }
+
+ @Override
+ InputStream open() throws IOException {
+ URLConnection conn = url.openConnection();
+ // System.err.println(conn.getClass().getName());
+
+ return conn.getInputStream();
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/test/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java
new file mode 100644
index 0000000..4e1a927
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/LazyZipEntryInputStream.java
@@ -0,0 +1,52 @@
+/*
+ * 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.shared.wg;
+
+
+import java.io.*;
+import java.util.zip.*;
+
+/**
+ *In test cases we cannot open all the input files
+ * while creating the test suite, but must defer the
+ * opening until the test is actually run.
+ */
+class LazyZipEntryInputStream extends LazyInputStream {
+
+ private ZipEntry entry;
+ private ZipFile zip;
+ /** Creates new LazyZipEntryInputStream */
+ LazyZipEntryInputStream(ZipFile zip,String name) {
+ // System.err.println(name);
+ entry = new ZipEntry(name);
+ this.zip = zip;
+ }
+
+
+ @Override
+ InputStream open() throws IOException {
+ InputStream rslt = zip.getInputStream(entry);
+ if ( rslt == null )
+ throw new IllegalArgumentException(entry.getName()+ " cannot be opened.");
+ return rslt;
+ }
+
+
+
+}
http://git-wip-us.apache.org/repos/asf/jena/blob/ca760f74/jena-core/src/test/java/org/apache/jena/shared/wg/package.html
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/package.html b/jena-core/src/test/java/org/apache/jena/shared/wg/package.html
new file mode 100644
index 0000000..8bd36a1
--- /dev/null
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/package.html
@@ -0,0 +1,30 @@
+<!--
+ 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.
+-->
+
+<html>
+<head>
+<title>shared.wg</title>
+</head>
+<body>
+This package defines some classes to help with accessing tests
+produced by the RDF Core and WebOnt WGs.
+The tests can be accessed either from the web,
+or from a zip on the web,
+from a local copy in the testing directory.
+</body>
+</html>
\ No newline at end of file
[06/10] jena git commit: JENA-1462: Use RIOT global default resolver.
Posted by an...@apache.org.
JENA-1462: Use RIOT global default resolver.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/aecfaac0
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/aecfaac0
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/aecfaac0
Branch: refs/heads/master
Commit: aecfaac0d631995120b77f22059291ffe6b9f06f
Parents: c055fa6
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:22:03 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:22:03 2018 +0000
----------------------------------------------------------------------
.../src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/aecfaac0/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java b/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
index ed37f2a..eccda5f 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/lang/ReaderRIOTRDFXML.java
@@ -30,7 +30,6 @@ import org.apache.jena.datatypes.TypeMapper ;
import org.apache.jena.graph.Node ;
import org.apache.jena.graph.NodeFactory ;
import org.apache.jena.graph.Triple ;
-import org.apache.jena.iri.IRIFactory;
import org.apache.jena.rdf.model.RDFErrorHandler ;
import org.apache.jena.rdfxml.xmlinput.* ;
import org.apache.jena.rdfxml.xmlinput.impl.ARPSaxErrorHandler ;
@@ -126,7 +125,7 @@ public class ReaderRIOTRDFXML implements ReaderRIOT
}
if ( JenaRuntime.isRDF11 )
- arp.getOptions().setIRIFactory(IRIFactory.iriImplementation());
+ arp.getOptions().setIRIFactory(IRIResolver.iriFactory);
try {
if ( reader != null )
[03/10] jena git commit: Deprecate FileUtils.toURL
Posted by an...@apache.org.
Deprecate FileUtils.toURL
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/a8c99ff7
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/a8c99ff7
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/a8c99ff7
Branch: refs/heads/master
Commit: a8c99ff7a095b473a756f6709fdb5803e42f625e
Parents: ed34030
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:15:15 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:15:15 2018 +0000
----------------------------------------------------------------------
.../main/java/org/apache/jena/util/FileUtils.java | 15 ++++++++++-----
.../java/org/apache/jena/util/TestFileUtils.java | 3 ++-
2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/a8c99ff7/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/util/FileUtils.java b/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
index 046d7dc..9c6473f 100644
--- a/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
+++ b/jena-core/src/main/java/org/apache/jena/util/FileUtils.java
@@ -177,23 +177,28 @@ public class FileUtils
return sbuff.toString();
}
-
- /** Turn a plain filename into a "file:" URL */
+ /** Turn a plain filename into a "file:" URL
+ * Use IRILib.filenameToIRI
+ * This remains only for legacy compatibility.
+ */
+ @Deprecated
public static String toURL(String filename)
{
if ( filename.length()>5
&& filename.substring(0,5).equalsIgnoreCase("file:") )
return filename ;
+ if ( filename.equals(".") )
+ filename = "" ;
+
/**
- * Convert a File, note java.net.URI appears to do the right thing.
+ * Convert a File, note java.net.URI does the right thing.
* viz:
* Convert to absolute path.
* Convert all % to %25.
* then convert all ' ' to %20.
* It quite probably does more e.g. ? #
- * But has bug in only having one / not three at beginning
-
+ * But has one /, not three, at beginning
*/
return "file://" + new File(filename).toURI().toString().substring(5);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/a8c99ff7/jena-core/src/test/java/org/apache/jena/util/TestFileUtils.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/util/TestFileUtils.java b/jena-core/src/test/java/org/apache/jena/util/TestFileUtils.java
index e800d30..b78b810 100644
--- a/jena-core/src/test/java/org/apache/jena/util/TestFileUtils.java
+++ b/jena-core/src/test/java/org/apache/jena/util/TestFileUtils.java
@@ -213,7 +213,8 @@ public class TestFileUtils extends TestCase {
checkToURL("ü","ü");
}
private void checkToURL(String fn, String match) {
- String r = FileUtils.toURL(fn);
+ @SuppressWarnings("deprecation")
+ String r = FileUtils.toURL(fn);
if (!r.matches("^.*/[^/]*" + match + "[^/]*$"))
fail("Converted \"" + fn + "\" to <" + r
+ "> which did not match /" + match + "/");
[04/10] jena git commit: N3IRIResolver for jena-core test support
only.
Posted by an...@apache.org.
N3IRIResolver for jena-core test support only.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/35a5cc92
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/35a5cc92
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/35a5cc92
Branch: refs/heads/master
Commit: 35a5cc927222ea69d827633e13dd9065676558eb
Parents: a8c99ff
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:17:22 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:17:22 2018 +0000
----------------------------------------------------------------------
.../java/org/apache/jena/n3/N3IRIResolver.java | 34 +++++++++++++++++---
.../java/org/apache/jena/n3/TestResolver.java | 7 ++--
2 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/35a5cc92/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
index f8ba6de..2084604 100644
--- a/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
+++ b/jena-core/src/main/java/org/apache/jena/n3/N3IRIResolver.java
@@ -19,19 +19,25 @@
package org.apache.jena.n3;
+import java.io.File;
+
import org.apache.jena.iri.IRI;
import org.apache.jena.iri.IRIException;
import org.apache.jena.iri.IRIFactory;
-import org.apache.jena.util.FileUtils ;
+import org.apache.jena.iri.ViolationCodes;
/** A simple class to access IRI resolution.
+ *
* Replaced by {@code org.apache.jena.riot.system.IRIResolver}
+ *
+ * Only exists for jena-core tests
*/
@Deprecated
public class N3IRIResolver {
/**
* The current working directory, as a string.
+ * Ends in "/".
*/
static private String globalBase = "http://localhost/LocalHostBase/" ;
@@ -39,9 +45,24 @@ public class N3IRIResolver {
// 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) { }
+ try { globalBase = cwdURL(); }
+ catch (Throwable th) {}
}
+
+ /** The current directory as a "file:" URL */
+ private static String cwdURL()
+ {
+ /**
+ * Convert a File, note java.net.URI does the right thing.
+ * viz:
+ * Convert to absolute path.
+ * Convert all % to %25.
+ * then convert all ' ' to %20.
+ * It quite probably does more e.g. ? #
+ * But has one /, not three, at beginning
+ */
+ return "file://" + new File("").toURI().toString().substring(5);
+ }
/**
* The current working directory, as an IRI.
@@ -51,9 +72,12 @@ public class N3IRIResolver {
/**
* An IRIFactory appropriately configuired.
*/
- static final IRIFactory factory = new IRIFactory(IRIFactory
- .jenaImplementation());
+ static final IRIFactory factory = new IRIFactory(IRIFactory.jenaImplementation());
static {
+ factory.shouldViolation(false,false);
+ factory.securityViolation(false,false);
+ factory.setIsWarning(ViolationCodes.UNREGISTERED_IANA_SCHEME, false);
+ factory.setIsError(ViolationCodes.UNREGISTERED_IANA_SCHEME, false);
factory.setSameSchemeRelativeReferences("file");
}
http://git-wip-us.apache.org/repos/asf/jena/blob/35a5cc92/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 832a4b7..1af8dc4 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
@@ -23,6 +23,7 @@ import junit.framework.TestSuite;
import org.apache.jena.n3.N3IRIResolver ;
import org.apache.jena.n3.JenaURIException ;
@SuppressWarnings("deprecation")
+// Tests the old N3IRIResolver which is now only used for tests.
public class TestResolver extends TestCase
{
public static TestSuite suite()
@@ -90,7 +91,8 @@ public class TestResolver extends TestCase
public void testURI_1() { execTest("", "http://example.org/", "http://example.org/"); }
public void testURI_2() { execTest("", "http://example.org/xyz_2007", "http://example.org/xyz_2007"); }
- public void testURI_3() { execTest("", "http://example.org/xyz 2007", "http://example.org/xyz 2007"); }
+ // RDF URI References - space in URI. Not IRIs.
+ //public void testURI_3() { execTest("", "http://example.org/xyz 2007", "http://example.org/xyz 2007"); }
public void testURI_4() { execTest("", "http://example.org/xyz__2007", "http://example.org/xyz__2007"); }
public void testURI_5() { execTest("", "http://example.org/xyz__abc", "http://example.org/xyz__abc"); }
@@ -222,7 +224,8 @@ public class TestResolver extends TestCase
public void testURI_file_7() { execTestMatch("file:foo", "file:xyz", "^file:///.*foo$") ; }
- public void testURI_file_8() { execTestMatch("file:foo", "file:a b", "^file:///.*foo$") ; }
+ // RDF URI References - space in URI. Not IRIs.
+ //public void testURI_file_8() { execTestMatch("file:foo", "file:a b", "^file:///.*foo$") ; }
// File URLs - test aren't exact as the depend where they are run.
[02/10] jena git commit: Use RIOT-wide global IRIResolver.iriFactory.
Posted by an...@apache.org.
Use RIOT-wide global IRIResolver.iriFactory.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ed34030f
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ed34030f
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ed34030f
Branch: refs/heads/master
Commit: ed34030fc9a75095a14e310159f3a314417d6647
Parents: ca760f7
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:13:26 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:13:26 2018 +0000
----------------------------------------------------------------------
.../src/main/java/org/apache/jena/riot/system/PrefixMapBase.java | 3 +--
.../src/main/java/org/apache/jena/riot/system/PrefixMapStd.java | 3 +--
.../org/apache/jena/sparql/expr/nodevalue/NodeFunctions.java | 3 ++-
.../org/apache/jena/query/TestParameterizedSparqlString.java | 4 ++--
jena-arq/src/test/java/org/apache/jena/riot/lang/TestIRI.java | 3 ++-
.../java/org/apache/jena/riot/system/AbstractTestPrefixMap.java | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/ed34030f/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapBase.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapBase.java b/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapBase.java
index d4d8fc4..63623af 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapBase.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapBase.java
@@ -27,7 +27,6 @@ import java.util.function.BiConsumer ;
import org.apache.jena.atlas.lib.Pair;
import org.apache.jena.iri.IRI;
-import org.apache.jena.iri.IRIFactory;
import org.apache.jena.shared.PrefixMapping ;
/**
@@ -65,7 +64,7 @@ public abstract class PrefixMapBase implements PrefixMap {
@Override
public void add(String prefix, String iriString) {
- this.add(prefix, IRIFactory.iriImplementation().create(iriString));
+ this.add(prefix, IRIResolver.iriFactory.create(iriString));
}
@Override
http://git-wip-us.apache.org/repos/asf/jena/blob/ed34030f/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapStd.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapStd.java b/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapStd.java
index 557d07d..4c15108 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapStd.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/system/PrefixMapStd.java
@@ -24,7 +24,6 @@ import java.util.Map ;
import org.apache.jena.atlas.lib.Pair ;
import org.apache.jena.iri.IRI ;
-import org.apache.jena.iri.IRIFactory ;
/**
* Default implementation of a {@link PrefixMap}, this implementation
@@ -66,7 +65,7 @@ public class PrefixMapStd extends PrefixMapBase {
@Override
public void add(String prefix, String iriString) {
prefix = canonicalPrefix(prefix);
- IRI iri = IRIFactory.iriImplementation().create(iriString);
+ IRI iri = IRIResolver.iriFactory.create(iriString);
prefixes.put(prefix, iri);
uriToPrefix.put(iriString, prefix) ;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/ed34030f/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/NodeFunctions.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/NodeFunctions.java b/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/NodeFunctions.java
index 9949ca8..15ef5a7 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/NodeFunctions.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/expr/nodevalue/NodeFunctions.java
@@ -28,6 +28,7 @@ import org.apache.jena.graph.NodeFactory ;
import org.apache.jena.iri.IRI ;
import org.apache.jena.iri.IRIFactory ;
import org.apache.jena.iri.Violation ;
+import org.apache.jena.riot.system.IRIResolver;
import org.apache.jena.sparql.expr.ExprEvalException ;
import org.apache.jena.sparql.expr.ExprTypeException ;
import org.apache.jena.sparql.expr.NodeValue ;
@@ -348,7 +349,7 @@ public class NodeFunctions {
return node.isLiteral() ;
}
- private static final IRIFactory iriFactory = IRIFactory.iriImplementation() ;
+ private static final IRIFactory iriFactory = IRIResolver.iriFactory;
public static boolean warningsForIRIs = false ;
// -------- IRI
http://git-wip-us.apache.org/repos/asf/jena/blob/ed34030f/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java b/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
index d3a6250..a3afcf1 100644
--- a/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
+++ b/jena-arq/src/test/java/org/apache/jena/query/TestParameterizedSparqlString.java
@@ -25,8 +25,8 @@ import java.util.TimeZone ;
import org.apache.jena.datatypes.TypeMapper ;
import org.apache.jena.graph.Node ;
import org.apache.jena.graph.NodeFactory ;
-import org.apache.jena.iri.IRIFactory ;
import org.apache.jena.rdf.model.* ;
+import org.apache.jena.riot.system.IRIResolver;
import org.apache.jena.shared.impl.PrefixMappingImpl ;
import org.apache.jena.sparql.ARQException ;
import org.apache.jena.sparql.syntax.Element ;
@@ -1129,7 +1129,7 @@ public class TestParameterizedSparqlString {
query.append("SELECT *");
query.append('\n');
query.append("WHERE { ?s ");
- query.appendIri(IRIFactory.iriImplementation().construct("http://example.org"));
+ query.appendIri(IRIResolver.iriFactory.construct("http://example.org"));
query.append(" ?o }");
test(query, new String[] { "SELECT", "*", "\n", "WHERE", "?s", "<http://example.org>", "?o" }, new String[] {});
http://git-wip-us.apache.org/repos/asf/jena/blob/ed34030f/jena-arq/src/test/java/org/apache/jena/riot/lang/TestIRI.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestIRI.java b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestIRI.java
index b9dfee1..b976e0a 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/lang/TestIRI.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/lang/TestIRI.java
@@ -27,6 +27,7 @@ import org.apache.jena.riot.ErrorHandlerTestLib.ExWarning ;
import org.apache.jena.riot.checker.CheckerIRI ;
import org.apache.jena.riot.system.Checker ;
import org.apache.jena.riot.system.ErrorHandler ;
+import org.apache.jena.riot.system.IRIResolver ;
import org.apache.jena.riot.system.RiotLib ;
import org.junit.Test ;
@@ -35,7 +36,7 @@ public class TestIRI extends BaseTest
static protected final ErrorHandler handler = new ErrorHandlerTestLib.ErrorHandlerEx() ;
static protected final Checker checker = new Checker(new ErrorHandlerTestLib.ErrorHandlerEx()) ;
- static IRIFactory factory = IRIFactory.iriImplementation() ;
+ static IRIFactory factory = IRIResolver.iriFactory;
@Test public void iri1() { testIRI("http://example/") ; }
http://git-wip-us.apache.org/repos/asf/jena/blob/ed34030f/jena-arq/src/test/java/org/apache/jena/riot/system/AbstractTestPrefixMap.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/system/AbstractTestPrefixMap.java b/jena-arq/src/test/java/org/apache/jena/riot/system/AbstractTestPrefixMap.java
index 0ddfe8f..09d27f1 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/system/AbstractTestPrefixMap.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/system/AbstractTestPrefixMap.java
@@ -27,7 +27,7 @@ import org.junit.Test ;
*
*/
public abstract class AbstractTestPrefixMap extends BaseTest {
- protected IRIFactory factory = IRIFactory.iriImplementation();
+ protected IRIFactory factory = IRIResolver.iriFactory;
/**
* Gets the prefix map implementation to test, each call should result in a
[07/10] jena git commit: JENA-1463: Fix for file://host/path
Posted by an...@apache.org.
JENA-1463: Fix for file://host/path
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/1d037e80
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/1d037e80
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/1d037e80
Branch: refs/heads/master
Commit: 1d037e80dfd8a91e9c4042f65695cadec4b17097
Parents: aecfaac
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:24:29 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:24:29 2018 +0000
----------------------------------------------------------------------
jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java | 6 +++---
.../org/apache/jena/atlas/lib/TestFilenameProcessing.java | 7 +++++--
2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/1d037e80/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
index 18f3b94..ffe05de 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/IRILib.java
@@ -192,14 +192,14 @@ public class IRILib
return plainFilenameToURL(fn2) ;
}
- // Starts file:///
+ // Starts file:// or file:///
if ( fn.startsWith("file:///") )
// Assume it's good and return as-is.
return fn ;
if ( fn.startsWith("file://") ) {
- String fn2 = fn.substring("file:/".length()) ; // Leave one "/"
- return plainFilenameToURL(fn2) ;
+ // file: URL with host name (maybe!)
+ return fn ;
}
// Must be file:/
http://git-wip-us.apache.org/repos/asf/jena/blob/1d037e80/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
----------------------------------------------------------------------
diff --git a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
index e34fe3e..84d08c4 100644
--- a/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
+++ b/jena-base/src/test/java/org/apache/jena/atlas/lib/TestFilenameProcessing.java
@@ -65,8 +65,11 @@ public class TestFilenameProcessing extends BaseTest
@Test
public void fileIRI_3() {
- String uri = testFileIRI("file://D.ttl") ;
- assertTrue(uri.endsWith("D.ttl")) ;
+ String fn = "file://some.host/D.ttl" ;
+ String uri1 = IRILib.filenameToIRI(fn) ;
+ assertEquals(fn, uri1);
+ String uri2 = IRILib.filenameToIRI(uri1) ;
+ assertEquals(uri1, uri2) ;
}
@Test
[05/10] jena git commit: Add documentation about legecay uses. Clean
classes.
Posted by an...@apache.org.
Add documentation about legecay uses. Clean classes.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/c055fa62
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/c055fa62
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/c055fa62
Branch: refs/heads/master
Commit: c055fa62b54ff800a820b87712a1c5403ff366e5
Parents: 35a5cc9
Author: Andy Seaborne <an...@apache.org>
Authored: Sat Jan 13 17:19:18 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Sat Jan 13 17:19:18 2018 +0000
----------------------------------------------------------------------
.../org/apache/jena/rdfxml/xmlinput/ARPOptions.java | 6 ++++++
.../jena/rdfxml/xmloutput/impl/BaseXMLWriter.java | 2 ++
.../jena/rdfxml/xmlinput/NTripleTestSuite.java | 8 ++++----
.../org/apache/jena/rdfxml/xmlinput/TestARPMain.java | 8 ++++----
.../org/apache/jena/rdfxml/xmlinput/URITests.java | 2 ++
.../org/apache/jena/rdfxml/xmlinput/WGTestSuite.java | 12 ++++++------
.../jena/shared/wg/InputStreamFactoryTests.java | 15 ++++++++-------
7 files changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/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 c66fae7..6df6fee 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,12 @@ public class ARPOptions implements ARPErrorNumbers {
private boolean embedding = false;
private int errorMode[] = defaultErrorMode.clone();
+ // Note: This is the legacy setup for jena-core only.
+ // When used normally, with RIOT, the IRIFcatory is
+ // org.apache.jena.riot.system.IRIResolver.iriFactory
+ // which is RDF 1.1 and also the IRIfcatory used by all
+ // RIOT parsing.
+
@SuppressWarnings("deprecation")
private static IRIFactory defaultIriFactory = IRIFactory.jenaImplementation() ;
private IRIFactory iriFactory = defaultIriFactory ;
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/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 26591f7..0bd4367 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
@@ -490,6 +490,8 @@ abstract public class BaseXMLWriter implements RDFXMLWriterI {
}
@SuppressWarnings("deprecation")
+ // Testing.
+ // Agrees with ARPOptions.defaultIriFactory.
static IRIFactory factory = IRIFactory.jenaImplementation();
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/NTripleTestSuite.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/NTripleTestSuite.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/NTripleTestSuite.java
index f5ae838..b40883c 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/NTripleTestSuite.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/NTripleTestSuite.java
@@ -31,7 +31,7 @@ import org.apache.jena.rdfxml.xmlinput.AResource ;
import org.apache.jena.rdfxml.xmlinput.NTriple ;
import org.apache.jena.rdfxml.xmlinput.impl.ARPResource ;
import org.apache.jena.rdfxml.xmlinput.impl.ARPSaxErrorHandler ;
-import org.apache.jena.shared.wg.TestInputStreamFactory ;
+import org.apache.jena.shared.wg.InputStreamFactoryTests ;
import org.junit.Assert ;
import org.xml.sax.SAXException ;
import org.xml.sax.SAXParseException ;
@@ -42,20 +42,20 @@ import org.xml.sax.SAXParseException ;
* Jena N-triple writer.
*/
class NTripleTestSuite extends WGTestSuite {
- NTripleTestSuite(TestInputStreamFactory fact, String name, boolean b) {
+ NTripleTestSuite(InputStreamFactoryTests fact, String name, boolean b) {
super(fact, name, b);
}
static TestSuite suite(IRI testDir, String d, String nm) {
return new NTripleTestSuite(
- new TestInputStreamFactory(testDir, d),
+ new InputStreamFactoryTests(testDir, d),
nm,
true);
}
static TestSuite suite(IRI testDir, IRI d, String nm) {
return new NTripleTestSuite(
- new TestInputStreamFactory(testDir, d),
+ new InputStreamFactoryTests(testDir, d),
nm,
true);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/TestARPMain.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/TestARPMain.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/TestARPMain.java
index e44105e..a8997e3 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/TestARPMain.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/TestARPMain.java
@@ -21,7 +21,7 @@ package org.apache.jena.rdfxml.xmlinput ;
import junit.framework.Test ;
import junit.framework.TestSuite ;
import org.apache.jena.iri.IRIFactory ;
-import org.apache.jena.shared.wg.TestInputStreamFactory ;
+import org.apache.jena.shared.wg.InputStreamFactoryTests ;
public class TestARPMain
{
@@ -30,7 +30,7 @@ public class TestARPMain
TestSuite test0 = new TestSuite("ARP") ;
WGTestSuite test1 =
new org.apache.jena.rdfxml.xmlinput.WGTestSuite(
- new TestInputStreamFactory(
+ new InputStreamFactoryTests(
IRIFactory
.iriImplementation()
.create(
@@ -1296,7 +1296,7 @@ public class TestARPMain
// test1.addTest(test173);
test0.addTest(test1) ;
WGTestSuite test175 = new org.apache.jena.rdfxml.xmlinput.WGTestSuite(
- new TestInputStreamFactory(IRIFactory.iriImplementation().create("http://jcarroll.hpl.hp.com/arp-tests/"),
+ new InputStreamFactoryTests(IRIFactory.iriImplementation().create("http://jcarroll.hpl.hp.com/arp-tests/"),
"arp"),
"ARP Tests", false) ;
TestSuite test176 = new TestSuite("ARP") ;
@@ -1483,7 +1483,7 @@ public class TestARPMain
test175.addTest(test176) ;
test0.addTest(test175) ;
WGTestSuite test211 = new org.apache.jena.rdfxml.xmlinput.NTripleTestSuite(
- new TestInputStreamFactory(
+ new InputStreamFactoryTests(
IRIFactory
.iriImplementation()
.create(
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/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 618e31c..44e851c 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
@@ -52,6 +52,8 @@ public class URITests
}
@SuppressWarnings("deprecation")
+ // Testing.
+ // Agrees with ARPOptions.defaultIriFactory.
static IRIFactory factory = IRIFactory.jenaImplementation();
// static {
// factory.useSpecificationRDF(false);
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
index 7984a32..20aa675 100644
--- a/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
+++ b/jena-core/src/test/java/org/apache/jena/rdfxml/xmlinput/WGTestSuite.java
@@ -46,7 +46,7 @@ import org.apache.jena.reasoner.test.WGReasonerTester ;
import org.apache.jena.shared.BrokenException ;
import org.apache.jena.shared.JenaException ;
import org.apache.jena.shared.impl.JenaParameters ;
-import org.apache.jena.shared.wg.TestInputStreamFactory ;
+import org.apache.jena.shared.wg.InputStreamFactoryTests ;
import org.apache.jena.vocabulary.OWLResults ;
import org.apache.jena.vocabulary.RDF ;
import org.apache.jena.vocabulary.RDFS ;
@@ -185,7 +185,7 @@ class WGTestSuite extends TestSuite implements ARPErrorNumbers {
}
};
- TestInputStreamFactory factory;
+ InputStreamFactoryTests factory;
static private Collection<String> misc =
Arrays.asList(
@@ -236,7 +236,7 @@ class WGTestSuite extends TestSuite implements ARPErrorNumbers {
});
}
- private Model loadRDF(final TestInputStreamFactory fact,
+ private Model loadRDF(final InputStreamFactoryTests fact,
final String file) {
Model m = null;
String base = fact.getBase().toString();
@@ -270,7 +270,7 @@ class WGTestSuite extends TestSuite implements ARPErrorNumbers {
*/
String createMe;
- WGTestSuite(TestInputStreamFactory fact, String name, boolean dynamic) {
+ WGTestSuite(InputStreamFactoryTests fact, String name, boolean dynamic) {
super(name);
factory = fact;
testDir = fact.getBase();
@@ -334,14 +334,14 @@ class WGTestSuite extends TestSuite implements ARPErrorNumbers {
static TestSuite suite(IRI testDir, String d, String nm) {
return new WGTestSuite(
- new TestInputStreamFactory(testDir, d),
+ new InputStreamFactoryTests(testDir, d),
nm,
true);
}
static TestSuite suite(IRI testDir, IRI d, String nm) {
return new WGTestSuite(
- new TestInputStreamFactory(testDir, d),
+ new InputStreamFactoryTests(testDir, d),
nm,
true);
}
http://git-wip-us.apache.org/repos/asf/jena/blob/c055fa62/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
----------------------------------------------------------------------
diff --git a/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java b/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
index 0375eec..1d7a59d 100644
--- a/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
+++ b/jena-core/src/test/java/org/apache/jena/shared/wg/InputStreamFactoryTests.java
@@ -30,12 +30,13 @@ import java.util.zip.ZipFile;
import org.apache.jena.iri.*;
import org.apache.jena.shared.JenaException ;
-/**
+/** In support of the RDF 2004 Working Group tests.
+ *
* This class provides input streams that:
* 1: can be from a URL or from a zip
* 2: do not actually open until the first read
*/
-public class TestInputStreamFactory {
+public class InputStreamFactoryTests {
@SuppressWarnings("deprecation")
final IRIFactory iriFactory = IRIFactory.jenaImplementation();
@@ -48,7 +49,7 @@ public class TestInputStreamFactory {
/** @param baseDir A prefix of all URLs accessed through this factory.
* @param getBaseDir Replace the baseDir into getBaseDir before opening any URL.
*/
- public TestInputStreamFactory(IRI baseDir, IRI getBaseDir) {
+ public InputStreamFactoryTests(IRI baseDir, IRI getBaseDir) {
base = baseDir;
mapBase = getBaseDir;
zip = null;
@@ -57,14 +58,14 @@ public class TestInputStreamFactory {
/** @param baseDir A prefix of all URLs accessed through this factory.
* @param zip To open a URL remove the baseDir from the URL and get the named file from the zip.
*/
- public TestInputStreamFactory(IRI baseDir, ZipFile zip) {
+ public InputStreamFactoryTests(IRI baseDir, ZipFile zip) {
base = baseDir;
mapBase = null;
this.zip = zip;
property = null;
}
- public TestInputStreamFactory(IRI baseDir, String propDir) {
+ public InputStreamFactoryTests(IRI baseDir, String propDir) {
createMe = "new TestInputStreamFactory(URI.create(\""+baseDir.toString()
+"\"),\""+propDir+"\")";
base = baseDir;
@@ -160,13 +161,13 @@ public class TestInputStreamFactory {
if (zip != null)
return new LazyZipEntryInputStream(zip,relPath );
else
- return TestInputStreamFactory.getInputStream(property + relPath );
+ return InputStreamFactoryTests.getInputStream(property + relPath );
}
private static InputStream getInputStream(String prop) {
// System.err.println(prop);
- ClassLoader loader = TestInputStreamFactory.class.getClassLoader();
+ ClassLoader loader = InputStreamFactoryTests.class.getClassLoader();
if (loader == null)
throw new SecurityException("Cannot access class loader");
InputStream in =
[08/10] jena git commit: Merge commit 'refs/pull/342/head' of
github.com:apache/jena
Posted by an...@apache.org.
Merge commit 'refs/pull/342/head' of github.com:apache/jena
This closes #342.
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/ecccd495
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/ecccd495
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/ecccd495
Branch: refs/heads/master
Commit: ecccd495420ed9e5003e697a7eb240ec6100f307
Parents: 58ac14b 1d037e8
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jan 15 11:28:55 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Jan 15 11:28:55 2018 +0000
----------------------------------------------------------------------
.../apache/jena/riot/lang/ReaderRIOTRDFXML.java | 3 +-
.../apache/jena/riot/system/PrefixMapBase.java | 3 +-
.../apache/jena/riot/system/PrefixMapStd.java | 3 +-
.../sparql/expr/nodevalue/NodeFunctions.java | 3 +-
.../query/TestParameterizedSparqlString.java | 4 +-
.../java/org/apache/jena/riot/lang/TestIRI.java | 3 +-
.../jena/riot/system/AbstractTestPrefixMap.java | 2 +-
.../java/org/apache/jena/atlas/lib/IRILib.java | 6 +-
.../jena/atlas/lib/TestFilenameProcessing.java | 7 +-
.../java/org/apache/jena/n3/N3IRIResolver.java | 34 +++-
.../apache/jena/rdfxml/xmlinput/ARPOptions.java | 6 +
.../rdfxml/xmloutput/impl/BaseXMLWriter.java | 2 +
.../jena/shared/wg/LazyFileInputStream.java | 46 -----
.../apache/jena/shared/wg/LazyInputStream.java | 62 ------
.../jena/shared/wg/LazyURLInputStream.java | 50 -----
.../jena/shared/wg/LazyZipEntryInputStream.java | 52 -----
.../jena/shared/wg/TestInputStreamFactory.java | 192 ------------------
.../java/org/apache/jena/shared/wg/package.html | 30 ---
.../java/org/apache/jena/util/FileUtils.java | 15 +-
.../java/org/apache/jena/n3/TestResolver.java | 7 +-
.../jena/rdfxml/xmlinput/NTripleTestSuite.java | 8 +-
.../jena/rdfxml/xmlinput/TestARPMain.java | 8 +-
.../apache/jena/rdfxml/xmlinput/URITests.java | 2 +
.../jena/rdfxml/xmlinput/WGTestSuite.java | 12 +-
.../jena/shared/wg/InputStreamFactoryTests.java | 193 +++++++++++++++++++
.../jena/shared/wg/LazyFileInputStream.java | 46 +++++
.../apache/jena/shared/wg/LazyInputStream.java | 62 ++++++
.../jena/shared/wg/LazyURLInputStream.java | 50 +++++
.../jena/shared/wg/LazyZipEntryInputStream.java | 52 +++++
.../java/org/apache/jena/shared/wg/package.html | 30 +++
.../org/apache/jena/util/TestFileUtils.java | 3 +-
31 files changed, 521 insertions(+), 475 deletions(-)
----------------------------------------------------------------------
[09/10] jena git commit: Rename private
ReaderRIOTFactoryImpl->ReaderRIOTLangFactory
Posted by an...@apache.org.
Rename private ReaderRIOTFactoryImpl->ReaderRIOTLangFactory
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/6283bddc
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/6283bddc
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/6283bddc
Branch: refs/heads/master
Commit: 6283bddcb5973a3826a1135f69b46c14a4fcc5d2
Parents: ecccd49
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jan 15 11:30:54 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Jan 15 11:30:54 2018 +0000
----------------------------------------------------------------------
.../java/org/apache/jena/riot/RDFParserRegistry.java | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/6283bddc/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java b/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
index 9edc963..612d506 100644
--- a/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
+++ b/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
@@ -59,7 +59,7 @@ public class RDFParserRegistry
private static Map<String, Lang> mapJenaNameToLang = new HashMap<>() ;
/** map language to a parser factory */
- private static Map<Lang, ReaderRIOTFactory> langToParserFactory = new HashMap<>() ;
+ private static Map<Lang, ReaderRIOTFactory> langToParserFactory = new HashMap<>() ;
/** Known triples languages */
private static Set<Lang> langTriples = new HashSet<>() ;
@@ -67,9 +67,9 @@ public class RDFParserRegistry
/** Known quads languages */
private static Set<Lang> langQuads = new HashSet<>() ;
- /** General parser factory for parsers implementned by "Lang" */
- private static ReaderRIOTFactory parserFactory = new ReaderRIOTFactoryImpl() ;
-
+ /** General parser factory for parsers implemented by "Lang" */
+ private static ReaderRIOTFactory parserFactory = new ReaderRIOTLangFactory() ;
+ // Others
private static ReaderRIOTFactory parserFactoryRDFXML = new ReaderRIOTRDFXML.Factory();
private static ReaderRIOTFactory parserFactoryJsonLD = new ReaderRIOTFactoryJSONLD() ;
private static ReaderRIOTFactory parserFactoryThrift = new ReaderRIOTFactoryThrift() ;
@@ -162,7 +162,7 @@ public class RDFParserRegistry
// Parser factories
- private static class ReaderRIOTFactoryImpl implements ReaderRIOTFactory
+ private static class ReaderRIOTLangFactory implements ReaderRIOTFactory
{
@Override
public ReaderRIOT create(Lang lang, ParserProfile parserProfile) {
@@ -175,10 +175,6 @@ public class RDFParserRegistry
private final Lang lang ;
private ParserProfile parserProfile = null ;
- ReaderRIOTLang(Lang lang) {
- this.lang = lang ;
- }
-
ReaderRIOTLang(Lang lang, ParserProfile parserProfile) {
this.lang = lang ;
this.parserProfile = parserProfile;
[10/10] jena git commit: Add TriG and NQ as langs for printing models
from cmd line query
Posted by an...@apache.org.
Add TriG and NQ as langs for printing models from cmd line query
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/aa25db6c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/aa25db6c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/aa25db6c
Branch: refs/heads/master
Commit: aa25db6c35b296a0d4e792d7a7631b543cf727e6
Parents: 6283bdd
Author: Andy Seaborne <an...@apache.org>
Authored: Mon Jan 15 11:32:52 2018 +0000
Committer: Andy Seaborne <an...@apache.org>
Committed: Mon Jan 15 11:32:52 2018 +0000
----------------------------------------------------------------------
.../jena/sparql/resultset/ResultsFormat.java | 19 ++++++++++++++-----
.../apache/jena/sparql/util/QueryExecUtils.java | 10 ++++++++++
2 files changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/aa25db6c/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
index f28a7bd..b959e60 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/resultset/ResultsFormat.java
@@ -63,7 +63,8 @@ public class ResultsFormat extends Symbol
static public ResultsFormat FMT_RDF_TTL = new ResultsFormat(contentTypeTurtle) ;
static public ResultsFormat FMT_RDF_TURTLE = new ResultsFormat(contentTypeTurtle) ;
static public ResultsFormat FMT_RDF_NT = new ResultsFormat(contentTypeNTriples) ;
- static public ResultsFormat FMT_TRIG = new ResultsFormat(contentTypeTriG) ;
+ static public ResultsFormat FMT_RDF_TRIG = new ResultsFormat(contentTypeTriG) ;
+ static public ResultsFormat FMT_RDF_NQ = new ResultsFormat(contentTypeNQuads) ;
static public ResultsFormat FMT_UNKNOWN = new ResultsFormat("unknown") ;
// ---- Compatibility
@@ -97,8 +98,12 @@ public class ResultsFormat extends Symbol
names.put("graph", FMT_RDF_TTL) ;
names.put("nt", FMT_RDF_NT) ;
names.put("n-triples", FMT_RDF_NT) ;
+ names.put("ntriples", FMT_RDF_NT) ;
- names.put("trig", FMT_TRIG) ;
+ names.put("nq", FMT_RDF_NQ) ;
+ names.put("nquads", FMT_RDF_NQ) ;
+ names.put("n-quads", FMT_RDF_NQ) ;
+ names.put("trig", FMT_RDF_TRIG) ;
}
@@ -119,7 +124,9 @@ public class ResultsFormat extends Symbol
}
public static boolean isDatasetSyntax(ResultsFormat fmt) {
- if ( FMT_TRIG.equals(fmt) )
+ if ( FMT_RDF_TRIG.equals(fmt) )
+ return true;
+ if ( FMT_RDF_NQ.equals(fmt) )
return true;
return false;
}
@@ -164,9 +171,11 @@ public class ResultsFormat extends Symbol
if ( url.endsWith(".tsv") )
return FMT_RS_TSV;
- // Trig for Dataset
+ // -- Dataset
if ( url.endsWith(".trig") )
- return FMT_TRIG;
+ return FMT_RDF_TRIG;
+ if ( url.endsWith(".nq") )
+ return FMT_RDF_NQ;
return defaultFormat;
}
http://git-wip-us.apache.org/repos/asf/jena/blob/aa25db6c/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java b/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
index dc495b0..61f2730 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/util/QueryExecUtils.java
@@ -241,6 +241,16 @@ public class QueryExecUtils {
return ;
}
+ if ( outputFormat.equals(ResultsFormat.FMT_RDF_NQ) ) {
+ model.write(System.out, "N-QUADS", null) ;
+ return ;
+ }
+
+ if ( outputFormat.equals(ResultsFormat.FMT_RDF_TRIG) ) {
+ model.write(System.out, "TriG", null) ;
+ return ;
+ }
+
System.err.println("Unknown format: " + outputFormat) ;
}