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 2023/10/24 08:56:59 UTC
[jena] branch jena5 updated (64f08554eb -> de12b16546)
This is an automated email from the ASF dual-hosted git repository.
andy pushed a change to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git
from 64f08554eb GH-2019: Don't produce SPDX; leave setup placeholder
new 53baf40c39 Fix IRIs.asBase
new de12b16546 Move rdf_tabales tests. Fix for space in working directory name
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../src/main/java/org/apache/jena/irix/IRIs.java | 30 ++++++++++++++--------
.../main/java/org/apache/jena/irix/SystemIRIx.java | 2 --
.../galbiston/rdf_tables/file/FileConverter.java | 3 +--
.../galbiston/rdf_tables/cli/ArgsConfigTest.java | 3 +--
.../datatypes/DatatypeControllerTest.java | 3 +--
.../rdf_tables/file/FileConverterTest.java | 10 +++++---
6 files changed, 29 insertions(+), 22 deletions(-)
rename jena-fuseki2/jena-fuseki-geosparql/src/test/java/{ => org/apache/jena/ext}/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java (98%)
rename jena-fuseki2/jena-fuseki-geosparql/src/test/java/{ => org/apache/jena/ext}/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java (98%)
rename jena-fuseki2/jena-fuseki-geosparql/src/test/java/{ => org/apache/jena/ext}/io/github/galbiston/rdf_tables/file/FileConverterTest.java (98%)
[jena] 02/02: Move rdf_tabales tests. Fix for space in working directory name
Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git
commit de12b1654645a949f8a5a60b861bc0a6cf7275d0
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Mon Oct 23 22:39:07 2023 +0100
Move rdf_tabales tests. Fix for space in working directory name
---
.../ext/io/github/galbiston/rdf_tables/file/FileConverter.java | 3 +--
.../io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java | 3 +--
.../galbiston/rdf_tables/datatypes/DatatypeControllerTest.java | 3 +--
.../io/github/galbiston/rdf_tables/file/FileConverterTest.java | 10 +++++++---
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/jena-fuseki2/jena-fuseki-geosparql/src/main/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverter.java b/jena-fuseki2/jena-fuseki-geosparql/src/main/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverter.java
index 6db8913f3b..fda4ff7594 100644
--- a/jena-fuseki2/jena-fuseki-geosparql/src/main/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverter.java
+++ b/jena-fuseki2/jena-fuseki-geosparql/src/main/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverter.java
@@ -99,9 +99,8 @@ public class FileConverter {
model.setNsPrefixes(PrefixController.getPrefixes());
} catch (IOException | RuntimeException | CsvValidationException ex) {
-
LOGGER.error("FileConverter: Line - {}, File - {}, Exception - {}", lineNumber, inputFile.getAbsolutePath(), ex.getMessage());
- throw new AssertionError("Error loading file: " + inputFile.getAbsolutePath());
+ throw new AssertionError("Error loading file: " + inputFile.getAbsolutePath(), ex);
}
LOGGER.info("File Conversion Completed: {}", inputFile.getPath());
diff --git a/jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java b/jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java
similarity index 98%
rename from jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java
rename to jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java
index bb694fb976..0d47750c64 100644
--- a/jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java
+++ b/jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/cli/ArgsConfigTest.java
@@ -15,12 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.galbiston.rdf_tables.cli;
+package org.apache.jena.ext.io.github.galbiston.rdf_tables.cli;
import com.beust.jcommander.JCommander;
import com.beust.jcommander.ParameterException;
-import org.apache.jena.ext.io.github.galbiston.rdf_tables.cli.ArgsConfig;
import org.apache.jena.riot.RDFFormat;
import org.junit.After;
import org.junit.AfterClass;
diff --git a/jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java b/jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java
similarity index 98%
rename from jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java
rename to jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java
index 4773c16817..5d9bf0d7a4 100644
--- a/jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java
+++ b/jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/datatypes/DatatypeControllerTest.java
@@ -15,12 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.galbiston.rdf_tables.datatypes;
+package org.apache.jena.ext.io.github.galbiston.rdf_tables.datatypes;
import static org.junit.Assert.assertEquals;
import org.apache.jena.datatypes.xsd.impl.XSDBaseNumericType;
-import org.apache.jena.ext.io.github.galbiston.rdf_tables.datatypes.DatatypeController;
import org.apache.jena.rdf.model.Literal;
import org.apache.jena.rdf.model.ResourceFactory;
import org.junit.*;
diff --git a/jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/file/FileConverterTest.java b/jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverterTest.java
similarity index 98%
rename from jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/file/FileConverterTest.java
rename to jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverterTest.java
index d5a30c5f5f..178c73088e 100644
--- a/jena-fuseki2/jena-fuseki-geosparql/src/test/java/io/github/galbiston/rdf_tables/file/FileConverterTest.java
+++ b/jena-fuseki2/jena-fuseki-geosparql/src/test/java/org/apache/jena/ext/io/github/galbiston/rdf_tables/file/FileConverterTest.java
@@ -15,18 +15,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package io.github.galbiston.rdf_tables.file;
+package org.apache.jena.ext.io.github.galbiston.rdf_tables.file;
import static org.junit.Assert.assertEquals;
import java.io.File;
+import java.net.URL;
+import org.apache.jena.atlas.lib.IRILib;
import org.apache.jena.datatypes.BaseDatatype;
import org.apache.jena.datatypes.xsd.XSDDatatype;
import org.apache.jena.datatypes.xsd.impl.XSDBaseNumericType;
import org.apache.jena.ext.io.github.galbiston.rdf_tables.datatypes.DatatypeController;
import org.apache.jena.ext.io.github.galbiston.rdf_tables.datatypes.PrefixController;
-import org.apache.jena.ext.io.github.galbiston.rdf_tables.file.FileConverter;
import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.RDF;
import org.apache.jena.vocabulary.RDFS;
@@ -45,7 +46,10 @@ public class FileConverterTest {
@BeforeClass
public static void setUpClass() {
- File inputFile = new File(FileConverterTest.class.getClassLoader().getResource("TestData.csv").getFile());
+ URL u = FileConverterTest.class.getClassLoader().getResource("TestData.csv");
+ // These URLs have the file name as an encoded string.
+ String fn = IRILib.decodeHex(u.getFile());
+ File inputFile = new File(fn);
testModel = ModelFactory.createDefaultModel();
DatatypeController.addPrefixDatatypeURI("wkt", "http://www.opengis.net/ont/geosparql#wktLiteral");
PrefixController.addPrefix("other", "http://example.org/other#");
[jena] 01/02: Fix IRIs.asBase
Posted by an...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
andy pushed a commit to branch jena5
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 53baf40c39d565df2f16db5589045819df471f78
Author: Andy Seaborne <an...@apache.org>
AuthorDate: Sun Oct 22 20:22:15 2023 +0100
Fix IRIs.asBase
---
.../src/main/java/org/apache/jena/irix/IRIs.java | 30 ++++++++++++++--------
.../main/java/org/apache/jena/irix/SystemIRIx.java | 2 --
2 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/jena-core/src/main/java/org/apache/jena/irix/IRIs.java b/jena-core/src/main/java/org/apache/jena/irix/IRIs.java
index 2cdbbc8bd4..12209317de 100644
--- a/jena-core/src/main/java/org/apache/jena/irix/IRIs.java
+++ b/jena-core/src/main/java/org/apache/jena/irix/IRIs.java
@@ -76,24 +76,32 @@ public class IRIs {
/**
* Given a candidate baseURI string, which may be a filename,
* turn it into a IRI suitable as a base IRI.
+ * This includes encoding characters in a filename (e.g. spaces).
*/
- public static String toBase(String baseURI) {
- if ( baseURI == null )
+ public static String toBase(String uriForBase) {
+ if ( uriForBase == null )
return getBaseStr();
- String scheme = scheme(baseURI);
+ String scheme = scheme(uriForBase);
if ( Sys.isWindows ) {
// Assume a scheme of one letter is a Windows drive letter.
if ( scheme != null && scheme.length() == 1 )
scheme = "file";
}
- // File scheme if the URI is "file:" or there is no scheme
- // and the system base is a "file:" URI
- boolean isFile = ( scheme != null )
- ? scheme.equals("file")
- : IRIs.getSystemBase().hasScheme("file");
- if ( isFile )
- baseURI = IRILib.encodeFileURL(baseURI);
- return IRIs.getSystemBase().resolve(baseURI).toString();
+ if ( scheme == null ) {
+ // Relative name: it the base is a file: URI, encode the relative
+ // name if it does not look like it is already encoded.
+ boolean isFileBase = IRIs.getSystemBase().hasScheme("file");
+ if ( isFileBase && ! uriForBase.contains("%") )
+ uriForBase = IRILib.encodeFileURL(uriForBase);
+ } else {
+ // If the scheme of the proposed base URI is file: then assume it is a legal IRI as intended.
+ // Pragmatically, fix-up a few characters that are illegal.
+ if ( scheme.equals("file") ) {
+ uriForBase = uriForBase.replace(" ", "%20");
+ uriForBase = uriForBase.replace("\\", "/");
+ }
+ }
+ return IRIs.getSystemBase().resolve(uriForBase).toString();
}
/** Return a general purpose resolver, with the current system base as its base IRI. */
diff --git a/jena-core/src/main/java/org/apache/jena/irix/SystemIRIx.java b/jena-core/src/main/java/org/apache/jena/irix/SystemIRIx.java
index a22fbb740d..ccffc388bf 100644
--- a/jena-core/src/main/java/org/apache/jena/irix/SystemIRIx.java
+++ b/jena-core/src/main/java/org/apache/jena/irix/SystemIRIx.java
@@ -123,8 +123,6 @@ public class SystemIRIx {
if ( baseStr == null )
return IRIx.create(fallbackBaseURI);
try {
- if ( !baseStr.endsWith("/") )
- baseStr = baseStr+"/";
IRIx base = IRIx.create(baseStr);
if ( ! base.isReference() )
Log.error(IRIs.class, "System base URI is not a reference URI: must have scheme, host and path");