This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit a615f26b782fc9f125cc2d7022e3e1e989e08e23 Author: Andy Seaborne <[email protected]> AuthorDate: Sat Oct 18 17:20:37 2025 +0100 GH-3528: Switch to jena-iri3986. Remove jena-iri usage. --- .../java/org/apache/jena/riot/system/Checker.java | 9 +- .../apache/jena/riot/system/CheckerJenaIRI.java | 126 ------- .../jena/riot/system/irix/TS_IRIxProviders.java | 1 - .../riot/system/irix/TestIRIxRIOT_JenaIRI.java | 91 ----- jena-cmds/src/main/java/jena/iri.java | 22 -- jena-core/pom.xml | 2 +- .../org/apache/jena/irix/IRIProviderJenaIRI.java | 400 --------------------- .../java/org/apache/jena/irix/SetupJenaIRI.java | 140 -------- .../main/java/org/apache/jena/irix/SystemIRIx.java | 15 +- .../jena/rdfxml/xmloutput/impl/BaseXMLWriter.java | 16 +- .../apache/jena/irix/AbstractTestIRIx_3986.java | 1 - .../org/apache/jena/irix/TestIRIxJenaSystem.java | 18 +- .../org/apache/jena/irix/TestIRIxNormalize.java | 6 - .../jena/reasoner/rulesys/test/OWLUnitTest.java | 62 ++-- .../ontology/owl/list-syntax/owlDemoSchema.xml | 4 +- jena-core/testing/wg/localtests/conclusions003.rdf | 4 +- jena-core/testing/wg/localtests/conclusions004.rdf | 2 +- jena-core/testing/wg/localtests/conclusions005.rdf | 2 +- jena-core/testing/wg/localtests/conclusions006.rdf | 2 +- jena-core/testing/wg/localtests/conclusions007.rdf | 2 +- jena-core/testing/wg/localtests/conclusions008.rdf | 2 +- jena-core/testing/wg/localtests/premises003.rdf | 4 +- jena-core/testing/wg/localtests/premises004.rdf | 2 +- jena-core/testing/wg/localtests/premises005.rdf | 2 +- jena-core/testing/wg/localtests/premises006.rdf | 2 +- jena-core/testing/wg/localtests/premises007.rdf | 2 +- jena-core/testing/wg/localtests/premises008.rdf | 2 +- 27 files changed, 64 insertions(+), 877 deletions(-) diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java b/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java index a5aa815473..de65ede41c 100644 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java +++ b/jena-arq/src/main/java/org/apache/jena/riot/system/Checker.java @@ -25,7 +25,6 @@ import org.apache.jena.datatypes.xsd.impl.RDFLangString; import org.apache.jena.graph.Node; import org.apache.jena.graph.TextDirection; import org.apache.jena.graph.Triple; -import org.apache.jena.iri.IRI; import org.apache.jena.irix.*; import org.apache.jena.langtagx.LangTagX; import org.apache.jena.sparql.core.Quad; @@ -100,10 +99,6 @@ public class Checker { public static boolean checkIRI(String iriStr, ErrorHandler errorHandler, long line, long col) { try { IRIx iri = IRIs.reference(iriStr); - if ( iri instanceof IRIProviderJenaIRI.IRIxJena jiri ) { - IRI jenaIRI = jiri.getImpl(); - return CheckerJenaIRI.iriViolations(jenaIRI, errorHandler, line, col); - } if ( ! iri.hasViolations() ) return true; // IRI errors are errorHandler warnings when checking. @@ -129,7 +124,7 @@ public class Checker { errorHandler(errorHandler).warning("Bad IRI: " + msg, line, col); } else errorHandler(errorHandler).warning("Unwise IRI: " + msg, line, col); - } catch (org.apache.jena.iri.IRIException0 | org.apache.jena.irix.IRIException ex) {} + } catch (org.apache.jena.irix.IRIException ex) {} } public static boolean checkLiteral(Node node) { @@ -208,7 +203,7 @@ public class Checker { if ( datatype.equals(XSDDatatype.XSDstring) ) // Simple literals are always well-formed... return true; - + // If the Literal has a datatype (but no language or base direction)... if ( datatype.equals(RDF.dtLangString) ) { errorHandler(errorHandler).warning("Literal has datatype "+datatype.getURI()+" but no language tag", line, col); diff --git a/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java b/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java deleted file mode 100644 index b725f6003b..0000000000 --- a/jena-arq/src/main/java/org/apache/jena/riot/system/CheckerJenaIRI.java +++ /dev/null @@ -1,126 +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.riot.system; - -import java.util.Iterator; - -import org.apache.jena.iri.IRI; -import org.apache.jena.iri.IRIComponents; -import org.apache.jena.iri.Violation; -import org.apache.jena.irix.IRIProviderJenaIRI; -import org.apache.jena.irix.IRIs; -import org.apache.jena.irix.SetupJenaIRI; -import org.apache.jena.irix.SystemIRIx; - -/** - * Copy of the Jena 5.1.0 Checker code (jena-iri related) - * called from ParserProfieStd. - * - * */ -class CheckerJenaIRI { - /** See also {@link IRIs#reference} */ - static boolean checkIRI(String iriStr, ErrorHandler errorHandler, long line, long col) { - IRI iri = SetupJenaIRI.iriCheckerFactory().create(iriStr); - boolean b = iriViolations(iri, errorHandler, line, col); - return b; - } - - /** - * Process violations on an IRI Calls the {@link ErrorHandler} on all errors and - * warnings (as warnings). - */ - static boolean iriViolations(IRI iri, ErrorHandler errorHandler, long line, long col) { - return iriViolations(iri, errorHandler, false, true, line, col); - } - - /** - * Process violations on an IRI Calls the errorHandler on all errors and warnings - * (as warning). (If checking for relative IRIs, these are sent out as errors.) - * Assumes error handler throws exceptions on errors if need be - */ - static boolean iriViolations(IRI iri, ErrorHandler errorHandler, - boolean allowRelativeIRIs, boolean includeIRIwarnings, - long line, long col) { - - if ( !allowRelativeIRIs && iri.isRelative() ) - // Relative IRIs. - iriViolationMessage(iri.toString(), true, "Relative IRI: " + iri, line, col, errorHandler); - - boolean isOK = true; - - if ( iri.hasViolation(includeIRIwarnings) ) { - Iterator<Violation> iter = iri.violations(includeIRIwarnings); - - for ( ; iter.hasNext() ; ) { - Violation v = iter.next(); - int code = v.getViolationCode(); - boolean isError = v.isError(); - - // --- Tune warnings. - // IRIProviderJena filters ERRORs and throws an exception on error. - // It can't add warnings or remove them at that point. - // Do WARN filtering here. - if ( code == Violation.LOWERCASE_PREFERRED && v.getComponent() != IRIComponents.SCHEME ) { - // Issue warning about the scheme part only. Not e.g. DNS names. - continue; - } - - isOK = false; - String msg = v.getShortMessage(); - String iriStr = iri.toString(); - //System.out.println("Warning: "+msg); - iriViolationMessage(iriStr, isError, msg, line, col, errorHandler); - } - } - return isOK; - } - - /** - * Common handling messages about IRIs during parsing whether a violation or an - * IRIException. Prints a warning, with different messages for IRI error or warning. - */ - static void iriViolationMessage(String iriStr, boolean isError, String msg, long line, long col, ErrorHandler errorHandler) { - try { - if ( ! ( SystemIRIx.getProvider() instanceof IRIProviderJenaIRI ) ) - msg = "<" + iriStr + "> : " + msg; - - if ( isError ) { - // ?? Treat as error, catch exceptions? - errorHandler(errorHandler).warning("Bad IRI: " + msg, line, col); - } else - errorHandler(errorHandler).warning("Not advised IRI: " + msg, line, col); - } catch (org.apache.jena.iri.IRIException0 | org.apache.jena.irix.IRIException ex) {} - } - - private static ErrorHandler errorHandler(ErrorHandler handler) { - return handler != null ? handler : ErrorHandlerFactory.errorHandlerStd; - } - - // Does nothing. Used in "check(node)" operations where the boolean result is key. - private static ErrorHandler nullErrorHandler = new ErrorHandler() { - @Override - public void warning(String message, long line, long col) {} - - @Override - public void error(String message, long line, long col) {} - - @Override - public void fatal(String message, long line, long col) {} - }; -} diff --git a/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TS_IRIxProviders.java b/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TS_IRIxProviders.java index 3fc8ae13a1..ced3fae86a 100644 --- a/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TS_IRIxProviders.java +++ b/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TS_IRIxProviders.java @@ -24,7 +24,6 @@ import org.junit.platform.suite.api.Suite; @Suite @SelectClasses({ TestIRIxRIOT_iri3986.class, - TestIRIxRIOT_JenaIRI.class }) public class TS_IRIxProviders {} diff --git a/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TestIRIxRIOT_JenaIRI.java b/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TestIRIxRIOT_JenaIRI.java deleted file mode 100644 index 6382ad1411..0000000000 --- a/jena-arq/src/test/java/org/apache/jena/riot/system/irix/TestIRIxRIOT_JenaIRI.java +++ /dev/null @@ -1,91 +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.riot.system.irix; - -import org.junit.jupiter.api.Test; - -import org.apache.jena.irix.IRIProvider; -import org.apache.jena.irix.IRIProviderJenaIRI; -import org.apache.jena.riot.Lang; - -/** - * Test IRIx in parser usage. - * jena-iri provider (up to Jena 5.2.0) - */ -public class TestIRIxRIOT_JenaIRI extends AbstractTestIRIxRIOT_system { - - protected TestIRIxRIOT_JenaIRI() { - super("jena-iri"); - } - private static final IRIProvider testProvider = makeTestProvider(); - private static final IRIProvider makeTestProvider() { - // Needs to agree with SystemIRIx. - IRIProvider newProviderJenaIRI = new IRIProviderJenaIRI(); - newProviderJenaIRI.strictMode("urn", false); - newProviderJenaIRI.strictMode("http", false); - newProviderJenaIRI.strictMode("file", false); - return newProviderJenaIRI; - } - - @Override - protected IRIProvider getProviderForTest() { - return testProvider; - } - - // Policy change: NT, no checking is "IRI 3986 syntax" - no scheme violations. - // // The IRIPRoviderJenaIRI handled this in a way that is not parser-checking sensitive. - - @Override @Test public void irix_http_2_nt_check() { testLang(httpUri02, Lang.NT, UNSET, TRUE, 0, 0); } - @Override @Test public void irix_http_2_ttl() { testLang(httpUri02, Lang.NT, UNSET, TRUE, 0, 0); } - - // http://EXAMPLE/ - @Override @Test public void irix_http_3_nt_check() { testLang(httpUri03, Lang.NT, UNSET, TRUE, 0, 0); } - @Override @Test public void irix_http_3_ttl() { testDft (httpUri03, Lang.TTL, 0, 0); } - - // jena-iri always warns on user/password in the authority. - // jena-iri3986 does not in NT unchecked. - // nt_check, ttl - different number of warnings. - @Override @Test public void irix_http_4_nt_check() { testLang(httpUri04, Lang.NT, UNSET, TRUE, 0, 1); } - @Override @Test public void irix_http_4_ttl() { testDft (httpUri04, Lang.TTL, 0, 1); } - - // jena-iri does not warn on user, no password - @Override @Test public void irix_http_5_nt() { testDft (httpUri05, Lang.NT, 0, 0); } - - //@Override @Test public void irix_urn_uuid_4_nt() { testDft (urnuuid04, Lang.NT, 0, 1); } - //@Override @Test public void irix_urn_uuid_6_nt() { testDft (urnuuid06, Lang.NT, 0, 1); } - - // The IRIPRoviderJenaIRI handled this in a way that is not parser-checking sensitive. - @Override @Test public void irix_urn_uuid_3_nt() { testDft (urnuuid03, Lang.NT, 0, 1); } - - // jena-iri3986 does not issue warning in NT, unchecked. - @Override @Test public void irix_uuid_3_nt() { testDft (uuid03, Lang.NT, 0, 1); } - @Override @Test public void irix_uuid_4_nt() { testDft (uuid04, Lang.NT, 0, 1); } - - @Override @Test public void irix_uuid_6_nt() { testDft (uuid06, Lang.NT, 0, 1); } - @Override @Test public void irix_uuid_6_nt_check() { testLang(uuid06, Lang.NT, UNSET, TRUE, 0, 1); } - @Override @Test public void irix_uuid_6_ttl() { testDft (uuid06, Lang.TTL, 0, 1); } - - // jena-iri is (too) lenient for uuid: - @Override @Test public void irix_uuid_7_nt() { testDft (urnuuid07, Lang.NT, 0, 0); } - @Override @Test public void irix_uuid_7_nt_check() { testLang(urnuuid07, Lang.NT, UNSET, TRUE, 0, 0); } - @Override @Test public void irix_uuid_7_ttl() { testDft (urnuuid07, Lang.TTL, 0, 0); } - - //@Override @Test public void irix_uuid_2_nt() { testDft (urnuuid02, Lang.NT, 0, 1); } - @Override @Test public void irix_uuid_8_nt() { testDft (urnuuid07, Lang.NT, 0, 0); } -} diff --git a/jena-cmds/src/main/java/jena/iri.java b/jena-cmds/src/main/java/jena/iri.java index eac84ab5d1..5a59f0e719 100644 --- a/jena-cmds/src/main/java/jena/iri.java +++ b/jena-cmds/src/main/java/jena/iri.java @@ -19,15 +19,11 @@ package jena; import java.io.PrintStream; -import java.util.Iterator ; import org.apache.jena.atlas.lib.Lib; -import org.apache.jena.iri.IRI ; -import org.apache.jena.iri.Violation ; import org.apache.jena.iri3986.provider.IRIProvider3986; import org.apache.jena.iri3986.provider.IRIProvider3986.IRIx3986; import org.apache.jena.irix.*; -import org.apache.jena.irix.IRIProviderJenaIRI.IRIxJena; import org.apache.jena.rfc3986.IRI3986; import org.apache.jena.rfc3986.IRIParseException; @@ -58,7 +54,6 @@ public class iri if ( setting != null ) { provider = switch(setting) { case "IRI3986" -> new IRIProvider3986(); - case "IRI0" -> new IRIProviderJenaIRI(); default -> { System.err.println("Unknown IRI Provider: "+setting); System.exit(1); @@ -83,11 +78,6 @@ public class iri print(iri3986, iriStr); continue; } - // jena-iri: The original Jena IRI subsystem - if ( irix instanceof IRIxJena iriJena ) { - print(iriJena, iriStr); - continue; - } print(irix, iriStr); } } @@ -128,18 +118,6 @@ public class iri } } - private static void print(IRIxJena jenaIRI, String iriStr) { - IRI iri = jenaIRI.getImpl(); - System.out.println(iriStr + " ==> " + iri); - if ( jenaIRI.isRelative() ) - System.out.println("Relative: " + iri.isRelative()); - - Iterator<Violation> vIter = iri.violations(true); - for ( ; vIter.hasNext() ; ) { - System.out.println(vIter.next().getShortMessage()); - } - } - private static void print(IRIx irix, String iriStr) { try { IRIx iri1 = irix.normalize(); diff --git a/jena-core/pom.xml b/jena-core/pom.xml index 7bcfafe088..6c2bd867ea 100644 --- a/jena-core/pom.xml +++ b/jena-core/pom.xml @@ -48,7 +48,7 @@ <artifactId>jena-iri3986</artifactId> <version>6.0.0-SNAPSHOT</version> </dependency> - + <dependency> <groupId>org.apache.jena</groupId> <artifactId>jena-langtag</artifactId> diff --git a/jena-core/src/main/java/org/apache/jena/irix/IRIProviderJenaIRI.java b/jena-core/src/main/java/org/apache/jena/irix/IRIProviderJenaIRI.java deleted file mode 100644 index e6c60ceb35..0000000000 --- a/jena-core/src/main/java/org/apache/jena/irix/IRIProviderJenaIRI.java +++ /dev/null @@ -1,400 +0,0 @@ -/* -T * 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.irix; - -import java.util.Iterator; -import java.util.Objects; -import java.util.function.BiConsumer; -import java.util.regex.Pattern; - -import org.apache.jena.iri.*; - -/** - * Provider for {@link IRIx} using the {@code jena-iri} module. - */ -public class IRIProviderJenaIRI implements IRIProvider { - - // Notes about jena-iri - // jena-iri:IRI.create is silent. - // jena-iri:IRI.construct throws errors. - // jena-iri:IRI.resolve is the same as create - - public IRIProviderJenaIRI() { } - - /** {@link IRIx} implementation for the jena-iri provider. */ - public static class IRIxJena extends IRIx { - private final IRI jenaIRI; - - private IRIxJena(String iriStr, IRI iri) { - super(iri.toString()); - this.jenaIRI = iri; - } - - @Override - public boolean isAbsolute() { - return jenaIRI.isAbsolute(); - } - - @Override - public boolean isRelative() { - return jenaIRI.isRelative(); - } - - @Override - public boolean isReference() { - if ( jenaIRI.isRootless() ) - return true; - - // isHierarchical. - return jenaIRI.getScheme() != null; - // Unnecessary There is always a path even if it's "". - /* && iri.getRawPath() != null*/ - } - - @Override - public boolean hasScheme(String scheme) { - String iriScheme = scheme(); - if ( iriScheme == null ) - return false; - return iriScheme.equalsIgnoreCase(scheme); - } - - @Override - public String scheme() { - return jenaIRI.getScheme(); - } - - @Override - public IRIx resolve(String other) { - IRI iri2 = jenaIRI.resolve(other); - return newIRIxJena(iri2); - } - - @Override - public IRIx resolve(IRIx other) { - IRIxJena iriOther = (IRIxJena)other; - IRI iri2 = jenaIRI.resolve(iriOther.jenaIRI); - return newIRIxJena(iri2); - } - - @Override - public IRIx normalize() { - IRI irin = jenaIRI.normalize(false); - return new IRIxJena(irin.toString(), irin); - } - - // The default setting in previous Jena. - static private int relFlags = IRIRelativize.SAMEDOCUMENT | IRIRelativize.ABSOLUTE | IRIRelativize.CHILD | IRIRelativize.PARENT; - @Override - public IRIx relativize(IRIx other) { - if ( jenaIRI.getRawQuery() != null ) - return null; - IRIxJena iriOther = (IRIxJena)other; - IRI iri2 = jenaIRI.relativize(iriOther.jenaIRI, relFlags); - if ( iri2.equals(iriOther.jenaIRI)) - return null; - return newIRIxJena(iri2); - } - - @Override - public IRI getImpl() { - return jenaIRI; - } - - @Override - public boolean hasViolations() { - return jenaIRI.hasViolation(false); - } - - @Override - public void handleViolations(BiConsumer<Boolean, String> handler) { - jenaIRI.violations(false) - .forEachRemaining(v->handler.accept(v.isError(), v.getShortMessage())); - } - - @Override - public int hashCode() { - return Objects.hash(jenaIRI); - } - - @Override - public boolean equals(Object obj) { - if ( this == obj ) - return true; - if ( obj == null ) - return false; - if ( getClass() != obj.getClass() ) - return false; - IRIxJena other = (IRIxJena)obj; - return Objects.equals(jenaIRI, other.jenaIRI); - } - } - - private static IRIxJena newIRIxJena(IRI iri2) { - String iriStr2 = iri2.toString(); - return newIRIxJena(iri2, iriStr2); - } - - private static IRIxJena newIRIxJena(IRI iri2, String iriStr2) { - IRIProviderJenaIRI.exceptions(iri2, iriStr2); - return new IRIxJena(iriStr2, iri2); - } - - @Override - public IRIx create(String iriStr) throws IRIException { - // "create" - does not throw exceptions - IRI iriObj = iriFactory().create(iriStr); - return newIRIxJena(iriObj, iriStr); - } - - @Override - public void check(String iriStr) throws IRIException { - IRI iri = iriFactory().create(iriStr); - exceptions(iri, iriStr); - } - - @Override - public void strictMode(String scheme, boolean runStrict) { - switch(scheme) { - case "urn": - STRICT_URN = runStrict; - break; - case "file": - STRICT_FILE = runStrict; - break; - case "http": - STRICT_HTTP = runStrict; - default: - } - } - - @Override - public boolean isStrictMode(String scheme) { - switch(scheme) { - case "urn": - return STRICT_URN; - case "file": - return STRICT_FILE; - case "http": - return STRICT_HTTP; - default: - return false; - } - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - // ----------------------------- - - private static IRIFactory iriFactory() { - return iriFactoryInst; - } - - // Parser settings. - private static final IRIFactory iriFactoryInst = SetupJenaIRI.setupCheckerIRIFactory(); - - private static boolean STRICT_HTTP = true; - private static boolean STRICT_URN = true; - private static boolean STRICT_FILE = true; - - private static final boolean showExceptions = true; - // Should be "false" in a release - this is an assist for development checking. - private static final boolean includeWarnings = false; - - private static IRI exceptions(IRI iri, String iriStr) { - if ( iriStr == null ) - iriStr = iri.toString(); - - // Additional checks - - // errors and warnings. - if ( STRICT_FILE && isFILE(iri) ) { - checkFile(iri, iriStr); - } else if ( isUUID(iri, iriStr) ) { - checkUUID(iri, iriStr); - } else if ( isURNUUID(iri, iriStr) ) { - checkURNUUID(iri, iriStr); - } - - if (!showExceptions) - return iri; - if (!iri.hasViolation(includeWarnings)) - return iri; - // Some error/warnings are scheme dependent. - Iterator<Violation> vIter = iri.violations(includeWarnings); - while(vIter.hasNext()) { - Violation v = vIter.next(); - - int code = v.getViolationCode() ; - // Filter codes. - // Global settings below; this section is for conditional filtering. - // See also Checker.iriViolations for WARN filtering. - switch(code) { - case Violation.PROHIBITED_COMPONENT_PRESENT->{ - // Allow "u:p@" when non-strict. - // Jena3 compatibility. - if ( isHTTP(iri) && ! STRICT_HTTP && v.getComponent() == IRIComponents.USER ) - continue; - } - case Violation.SCHEME_PATTERN_MATCH_FAILED->{ - if ( isURN(iri) && ! STRICT_URN ) - continue; - if ( isFILE(iri) ) - continue; - } - case Violation.REQUIRED_COMPONENT_MISSING->{ - // jena-iri handling of "file:" URIs is only for (an interpretation of) RFC 1738. - // RFC8089 allows relative file URIs and a wider use of characters. - if ( isFILE(iri) ) - continue; - } - } - // Signal first error. - String msg = v.getShortMessage(); - throw new IRIException(msg); - } - return iri; - } - - // HTTP and HTTPS - private static boolean isHTTP(IRI iri) { - return "http".equalsIgnoreCase(iri.getScheme()) - || "https".equalsIgnoreCase(iri.getScheme()); - } - - private static boolean isURN(IRI iri) { return "urn".equalsIgnoreCase(iri.getScheme()); } - private static boolean isFILE(IRI iri) { return "file".equalsIgnoreCase(iri.getScheme()); } - - private static void checkFile(IRI iri, String iriStr) { - if ( iriStr.startsWith("file://" ) && ! iriStr.startsWith("file:///") ) - throw new IRIException("file: URLs should start file:///: <"+iriStr+">"); - } - - private static boolean isUUID(IRI iri, String iriStr) { - // Ignore case - return iriStr.regionMatches(true, 0, "uuid:", 0, "uuid:".length()); - } - - private static boolean isURNUUID(IRI iri, String iriStr) { - // Ignore case - return iriStr.regionMatches(true, 0, "urn:uuid:", 0, "urn:uuid:".length()); - } - - // ---- uuid: - // UUID match, no anchors or URI scheme. - private static String UUID_BASE = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"; - private static String UUID_REGEXP = "^uuid:"+UUID_BASE+"$"; - private static Pattern UUID_PATTERN = Pattern.compile(UUID_REGEXP, Pattern.CASE_INSENSITIVE); - - private static void checkUUID(IRI iriObj, String original) { - if ( iriObj.hasViolation(true) ) - // Already has problems. - return; - // jena-iri does not have UUID checks. - // Unfortunately, these tests are check/no-check sensitive. - if ( iriObj.getRawFragment() != null ) - throw new IRIException("Fragment used with uuid:"); - if ( iriObj.getRawQuery() != null ) - throw new IRIException("Query used with uuid:"); - boolean matches = UUID_PATTERN.matcher(original).matches(); - if ( !matches ) - throw new IRIException("Not a valid UUID string: "+original); - } - - - // ---- urn:uuid: - // RFC 8141 added the possibility for r-component, q-component (combined - // into the URI query string) and f-component (restricted fragment). This - // regexp has a weak test for r/q/f. It does not check the character - // limitations to ASCII on r/q/f - - //private static String A2Z = "[0-9a-z]"; - - // Non-strict regexp: Any order r- and q-compoments, UCSchars. - private static String URN_UUID_REGEXP_LAX = "^urn:uuid:"+UUID_BASE+"(?:(?:\\?\\+.|\\?=.|#).*)?$"; - - // Strict regex for urn:uuid - // Only ASCII. - // pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - // pct-encoded = "%" HEXDIG HEXDIG - // unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - // iunreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" / ucschar - // reserved = gen-delims / sub-delims - // gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@" - // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" - // / "*" / "+" / "," / ";" / "=" - // Not: - // ipchar = iunreserved / pct-encoded / sub-delims / ":" / "@" - // = ipchar / ucschar - -// ucschar = %xA0-D7FF / %xF900-FDCF / %xFDF0-FFEF -// / %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD -// / %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD -// / %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD -// / %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD -// / %xD0000-DFFFD / %xE1000-EFFFD - - // "(?: )" is a non-binding group. - private static String PCT = "(?:%[a-f][a-f])"; - - // As contents of "[]" used in PCHAR - private static String UNRESERVED = "-0-9a-z._~"; - // Or use \p{IsAlphabetic} - private static String UCSCHAR = "\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF"; - /* Beyond 16 bits: - / %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD - / %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD - / %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD - / %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD - / %xD0000-DFFFD / %xE1000-EFFFD - */ - // private = %xE000-F8FF / %xF0000-FFFFD / %x100000-10FFFD - //private static String IPRIVATE - private static String IUNRESERVED = UNRESERVED+UCSCHAR; - - //private static String GEN_DELIMS = ":/\\?#\\[\\]@"; - private static String SUB_DELIMS = "!\\$&'\\(\\)\\*\\+,;="; - // Switch IUNRESERVED / UNRESERVED - private static String PCHARS1 = UNRESERVED+SUB_DELIMS+":"+"@"; - private static String PCHAR = "(?:(?:["+PCHARS1+"]|"+PCT+"))"; - - // Elements of components. - private static String URN_COMPONENT_X = "/\\?"; // "/" and "?" - private static String URN_RQ_COMPONENT_CHAR = PCHAR+URN_COMPONENT_X; - // Optional components - private static String URN_R_COMPONENT = "(?:\\?\\+["+URN_RQ_COMPONENT_CHAR+"]+)?"; - private static String URN_Q_COMPONENT = "(?:\\?=["+URN_RQ_COMPONENT_CHAR+"]+)?"; - private static String URN_F_COMPONENT = "(?:#["+PCHAR+"]*)?"; - // scheme , NID, uuid, optional URN_R_COMPONENT, optional URN_Q_COMPONENT, optional F_COMPONENT - private static String URN_UUID_REGEXP = "^urn:uuid:"+UUID_BASE+URN_R_COMPONENT+URN_Q_COMPONENT+URN_F_COMPONENT+"$"; - - private static Pattern URN_UUID_PATTERN = Pattern.compile(URN_UUID_REGEXP, Pattern.CASE_INSENSITIVE); - - private static void checkURNUUID(IRI iriObj, String original) { - if ( iriObj.hasViolation(true) ) - // Already has problems. - return; - boolean matches = URN_UUID_PATTERN.matcher(original).matches(); - if ( !matches ) - throw new IRIException("Not a valid UUID string: "+original); - } -} \ No newline at end of file diff --git a/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java b/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java deleted file mode 100644 index 968e48a7ee..0000000000 --- a/jena-core/src/main/java/org/apache/jena/irix/SetupJenaIRI.java +++ /dev/null @@ -1,140 +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.irix; - -import java.io.PrintStream; - -import org.apache.jena.iri.IRIFactory; -import org.apache.jena.iri.ViolationCodes; -import org.apache.jena.iri.impl.PatternCompiler; - -/** Setup of jena-iri package IRI Factory for parsing and for checking. */ -public class SetupJenaIRI { - - private static final IRIFactory iriFactoryInst = setupIRIFactory(); - private static final IRIFactory iriCheckerInst = setupCheckerIRIFactory(); - - /** - * The IRI checker setup, focused on parsing and languages. - * This is a clean version of jena-iri {@link IRIFactory#iriImplementation()} - * modified to allow unregistered schemes and allow {@code <file:relative>} IRIs. - */ - public static IRIFactory iriFactory() { - return iriFactoryInst; - } - - /** - * An IRIFactory with more detailed warnings. - */ - public static IRIFactory iriCheckerFactory() { - return iriCheckerInst; - } - - /*package*/ static final IRIFactory setupIRIFactory() { - return setupCheckerIRIFactory(); - } - - /** IRI Factory with "checker" settings. */ - /*package*/ static final IRIFactory setupCheckerIRIFactory() { - // See IRIProviderJenaIRI.exceptions for context specific tuning. - // See Checker.iriViolations for filtering and output from parsers. - - IRIFactory iriCheckerFactory = new IRIFactory(); - - //iriCheckerInst.shouldViolation(false,true); - // These two are from IRIFactory.iriImplementation() ... - iriCheckerFactory.useSpecificationIRI(true); - iriCheckerFactory.useSchemeSpecificRules("*", true); - // Allow relative references for file: URLs. - iriCheckerFactory.setSameSchemeRelativeReferences("file"); - - // See also IRIProviderJenaIRI where this is restricted to the scheme component. - setErrorWarning(iriCheckerFactory, ViolationCodes.LOWERCASE_PREFERRED, false, true); - // Jena3 compatibility (false, false) for this one. - setErrorWarning(iriCheckerFactory, ViolationCodes.PERCENT_ENCODING_SHOULD_BE_UPPERCASE, false, false); - - // -- Scheme specific rules. - setErrorWarning(iriCheckerFactory, ViolationCodes.SCHEME_PATTERN_MATCH_FAILED, false, true); - // jena-iri produces an error for PROHIBITED_COMPONENT_PRESENT regardless. - // See Checker.iriViolations for handling this - //setErrorWarning(iriCheckerFactory, ViolationCodes.PROHIBITED_COMPONENT_PRESENT, false, true); - - // == Scheme - setErrorWarning(iriCheckerFactory, ViolationCodes.UNREGISTERED_IANA_SCHEME, false, false); - setErrorWarning(iriCheckerFactory, ViolationCodes.UNREGISTERED_NONIETF_SCHEME_TREE, false, false); - - // == DNS name. - setErrorWarning(iriCheckerFactory, ViolationCodes.NOT_DNS_NAME, false, false); - // RFC3986 allows present-encoded DNS names. - setErrorWarning(iriCheckerFactory, ViolationCodes.USE_PUNYCODE_NOT_PERCENTS, false, false); - - // == Port related - setErrorWarning(iriCheckerFactory, ViolationCodes.PORT_SHOULD_NOT_BE_EMPTY, false, true); - setErrorWarning(iriCheckerFactory, ViolationCodes.PORT_SHOULD_NOT_START_IN_ZERO, false, true); - setErrorWarning(iriCheckerFactory, ViolationCodes.DEFAULT_PORT_SHOULD_BE_OMITTED, false, true); - // Warning in Jena3. "Well known" is ports 0 to 1023. - setErrorWarning(iriCheckerFactory, ViolationCodes.PORT_SHOULD_NOT_BE_WELL_KNOWN, false, false); - - // == Authority - setErrorWarning(iriCheckerFactory, ViolationCodes.HAS_PASSWORD, false, true); - setErrorWarning(iriCheckerFactory, ViolationCodes.PROHIBITED_COMPONENT_PRESENT, false, true); - - // == Path - setErrorWarning(iriCheckerFactory, ViolationCodes.NON_INITIAL_DOT_SEGMENT, false, false); - - // == Character related. - // Causes confusion! And this is only advice in RDF Concepts. - setErrorWarning(iriCheckerFactory, ViolationCodes.NOT_NFC, false, false); - // NFKC is not mentioned in RDF 1.1. Switch off. - setErrorWarning(iriCheckerFactory, ViolationCodes.NOT_NFKC, false, false); - // The MAYBE ViolationCodes are never generated. - - // ** Applies to various unicode blocks. - - // Needed to be (false, false) for some Turtle tests (due to EricP!) - setErrorWarning(iriCheckerFactory, ViolationCodes.COMPATIBILITY_CHARACTER, false, false); - setErrorWarning(iriCheckerFactory, ViolationCodes.UNDEFINED_UNICODE_CHARACTER, false, false); - // Otherwise the set of legal characters depends on the Java version. - // If not set, this causes test failures in Turtle and Trig eval tests. - setErrorWarning(iriCheckerFactory, ViolationCodes.UNASSIGNED_UNICODE_CHARACTER, false, false); - - // == Percent encoded. - setErrorWarning(iriCheckerFactory, ViolationCodes.SUPERFLUOUS_NON_ASCII_PERCENT_ENCODING, false, true); - setErrorWarning(iriCheckerFactory, ViolationCodes.SUPERFLUOUS_ASCII_PERCENT_ENCODING, false, true); - - return iriCheckerFactory; - } - - /** Set the error/warning state of a violation code. - * @param factory IRIFactory - * @param code ViolationCodes constant - * @param isError Whether it is to be treated an error. - * @param isWarning Whether it is to be treated a warning. - */ - static void setErrorWarning(IRIFactory factory, int code, boolean isError, boolean isWarning) { - factory.setIsWarning(code, isWarning); - factory.setIsError(code, isError); - } - - private static void printErrorWarning(PrintStream ps, IRIFactory factory, int code) { - String x = PatternCompiler.errorCodeName(code); - ps.printf("%-40s : E:%-5s W:%-5s\n", x, factory.isError(code), factory.isWarning(code)); - } - -} 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 747edc8b01..1b0f1106fb 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 @@ -35,9 +35,9 @@ public class SystemIRIx { private enum ProviderImpl { IRI0, IRI3986 } // **** Default system IRI provider // Jena 5.x : default is the legacy jena-iri - private static final ProviderImpl providerImpl = ProviderImpl.IRI0; + //private static final ProviderImpl providerImpl = ProviderImpl.IRI0; // Jena 6.x : jena-iri3986 - //private static final ProviderImpl providerImpl = ProviderImpl.IRI3986; + private static final ProviderImpl providerImpl = ProviderImpl.IRI3986; // -- System-wide provider. private static IRIProvider provider = makeFreshSystemProvider(); @@ -192,11 +192,12 @@ public class SystemIRIx { // -- Providers private static IRIProvider makeProviderJenaIRI() { - IRIProvider newProviderJenaIRI = new IRIProviderJenaIRI(); - newProviderJenaIRI.strictMode("urn", false); - newProviderJenaIRI.strictMode("http", false); - newProviderJenaIRI.strictMode("file", false); - return newProviderJenaIRI; + throw new JenaException("No ProviderJenaIRI in Jena6"); +// IRIProvider newProviderJenaIRI = new IRIProviderJenaIRI(); +// newProviderJenaIRI.strictMode("urn", false); +// newProviderJenaIRI.strictMode("http", false); +// newProviderJenaIRI.strictMode("file", false); +// return newProviderJenaIRI; } private static IRIProvider makeProviderIRI3986() { 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 045e168658..bf24df42b4 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 @@ -27,7 +27,6 @@ import java.util.Map.Entry ; import java.util.regex.Pattern ; import org.apache.jena.irix.IRIException; -import org.apache.jena.irix.IRIProviderJenaIRI.IRIxJena; import org.apache.jena.irix.IRIs; import org.apache.jena.irix.IRIx; import org.apache.jena.rdf.model.* ; @@ -803,17 +802,12 @@ abstract public class BaseXMLWriter implements RDFXMLWriterI { private String relativize( IRIx base, String uri ) { if ( relativeFlags == 0 ) return uri; - // If jena-iri - if ( base instanceof IRIxJena ) { - org.apache.jena.iri.IRI baseImpl = ((IRIxJena)base).getImpl(); - return baseImpl.relativize(uri, relativeFlags).toString(); - } try { - if ( relativeFlags != dftRelativeFlags ) { - // Use jena-iri for relativization. Backwards compatibility. - org.apache.jena.iri.IRI baseImpl = org.apache.jena.iri.IRIFactory.iriImplementation().create(base.str()); - return baseImpl.relativize(uri, relativeFlags).toString(); - } +// if ( relativeFlags != dftRelativeFlags ) { +// // Use jena-iri for relativization. Backwards compatibility. +// org.apache.jena.iri.IRI baseImpl = org.apache.jena.iri.IRIFactory.iriImplementation().create(base.str()); +// return baseImpl.relativize(uri, relativeFlags).toString(); +// } // if ( relativeFlags == 1 ) { // IRI3986 iri1 = IRI3986.create(base.str()); // IRI3986 iri2 = IRI3986.create(uri); diff --git a/jena-core/src/test/java/org/apache/jena/irix/AbstractTestIRIx_3986.java b/jena-core/src/test/java/org/apache/jena/irix/AbstractTestIRIx_3986.java index 3f5abbfdc1..d8e55ba33a 100644 --- a/jena-core/src/test/java/org/apache/jena/irix/AbstractTestIRIx_3986.java +++ b/jena-core/src/test/java/org/apache/jena/irix/AbstractTestIRIx_3986.java @@ -42,7 +42,6 @@ public class AbstractTestIRIx_3986 { public static Iterable<Object[]> data() { List<Object[]> data = new ArrayList<>(); data.add(new Object[]{"IRI3986", new IRIProvider3986()}); - data.add(new Object[]{"JenaIRI", new IRIProviderJenaIRI()}); // Does not pass the test suite. //data.add(new Object[]{"JDK.URI", new IRIProviderJDK()}); diff --git a/jena-core/src/test/java/org/apache/jena/irix/TestIRIxJenaSystem.java b/jena-core/src/test/java/org/apache/jena/irix/TestIRIxJenaSystem.java index c24561f4fc..2899666ede 100644 --- a/jena-core/src/test/java/org/apache/jena/irix/TestIRIxJenaSystem.java +++ b/jena-core/src/test/java/org/apache/jena/irix/TestIRIxJenaSystem.java @@ -29,8 +29,6 @@ import org.junit.runner.RunWith; import org.junit.runners.MethodSorters; import org.junit.runners.Parameterized; -import org.apache.jena.iri.IRI; - /** * Test of parsing and schema violations. * <p> @@ -185,7 +183,7 @@ public class TestIRIxJenaSystem extends AbstractTestIRIx_3986 { @Test public void parse_file_02() { badSpecific("file://host/file/name.txt"); } // This is legal by RFC 8089 (jena-iri, based on the original RFC 1738, fails this with missing authority). - @Test public void parse_file_03() { goodNoIRICheck("file:/file/name.txt"); } + @Test public void parse_file_03() { good("file:/file/name.txt"); } // -- FTP @@ -362,25 +360,11 @@ public class TestIRIxJenaSystem extends AbstractTestIRIx_3986 { private void good(String string) { IRIx iri = test_create(string); assertNotNull(iri); - if ( true ) { - // Run against checking mode. - IRI iri1 = SetupJenaIRI.iriCheckerFactory().create(string); - if ( iri1.hasViolation(true) ) { - iri1.violations(true).forEachRemaining(v-> System.err.println("IRI = "+string + " :: "+v.getLongMessage())); - fail("Violations "+string); - } - } // Check that the JDK can at least parse the string. java.net.URI javaURI = java.net.URI.create(string); assertNotNull(javaURI); } - // Where jena-iri odes not get the right answer. - private void goodNoIRICheck(String string) { - IRIx iri = test_create(string); - java.net.URI javaURI = java.net.URI.create(string); - } - // Expect an IRIParseException private void bad(String string) { try { diff --git a/jena-core/src/test/java/org/apache/jena/irix/TestIRIxNormalize.java b/jena-core/src/test/java/org/apache/jena/irix/TestIRIxNormalize.java index 59434a79a9..1486fe9c91 100644 --- a/jena-core/src/test/java/org/apache/jena/irix/TestIRIxNormalize.java +++ b/jena-core/src/test/java/org/apache/jena/irix/TestIRIxNormalize.java @@ -107,12 +107,6 @@ public class TestIRIxNormalize extends AbstractTestIRIx_3986 { } private void testNormalize(String input, String expected) { - // jena-iri does not implement normalization. - if (getProvider() instanceof IRIProviderJenaIRI ) - // jena-iri does not implement normalization. - return; - // assumefalse is unreliable in mixed JUnit3 overall runner - //assumeFalse("jena-iri does not implement normalization", (getProvider() instanceof IRIProviderJenaIRI) ); IRIx iri = test_create(input); IRIx iri2 = iri.normalize(); String s = iri2.toString(); diff --git a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/OWLUnitTest.java b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/OWLUnitTest.java index a857e0e815..c7f816a515 100644 --- a/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/OWLUnitTest.java +++ b/jena-core/src/test/java/org/apache/jena/reasoner/rulesys/test/OWLUnitTest.java @@ -31,19 +31,19 @@ import org.apache.jena.reasoner.rulesys.*; * Version of the OWL unit tests used during development of the mini ruleset. */ public class OWLUnitTest extends TestCase { - + // -------------- statics defining the whole test suite --------------------- - + /** The set of reasoner(factories) to test */ public static ReasonerFactory[] reasonerFactories = { OWLFBRuleReasonerFactory.theInstance(), OWLMicroReasonerFactory.theInstance(), OWLMiniReasonerFactory.theInstance() }; - + /** The names of the reasoner(factories) to report in the test suite */ public static final String[] reasonerNames = { "full", "Micro", "Mini" }; - + /** bit flag to indicate the test should be passed by the default reasoner */ public static final int FB = 1; @@ -52,7 +52,7 @@ public class OWLUnitTest extends TestCase { /** bit flag to indicate the test should be passed by the micro reasoner */ public static final int MICRO = 4; - + // Flags from OWLConsistencyTest, copied here for brevity public static final int INCONSISTENT = OWLConsistencyTest.INCONSISTENT; public static final int WARNINGS = OWLConsistencyTest.WARNINGS; @@ -63,7 +63,7 @@ public class OWLUnitTest extends TestCase { // /* // subClass new TestDef("localtests/ManifestSubclass001.rdf", FB | MICRO | MINI), - + // equivalentClass new TestDef("equivalentClass/Manifest001.rdf", FB | MICRO | MINI), new TestDef("equivalentClass/Manifest002.rdf", FB | MICRO | MINI), @@ -79,17 +79,17 @@ public class OWLUnitTest extends TestCase { // unionOf new TestDef("unionOf/Manifest001.rdf", FB | MICRO | MINI ), - + // This could be supported but isn't at the moment // new TestDef("unionOf/Manifest002.rdf", FB | MICRO | MINI), - + // Property axioms new TestDef("SymmetricProperty/Manifest001.rdf", FB | MICRO | MINI), new TestDef("SymmetricProperty/Manifest001.rdf", FB | MICRO | MINI), new TestDef("inverseOf/Manifest001.rdf", FB | MICRO | MINI), new TestDef("TransitiveProperty/Manifest001.rdf", FB | MICRO | MINI), new TestDef("localtests/Manifest005.rdf", FB | MICRO | MINI), - + // Equality related new TestDef("FunctionalProperty/Manifest001.rdf", FB | MINI), new TestDef("FunctionalProperty/Manifest002.rdf", FB | MINI), @@ -98,7 +98,7 @@ public class OWLUnitTest extends TestCase { new TestDef("InverseFunctionalProperty/Manifest002.rdf", FB | MINI), new TestDef("InverseFunctionalProperty/Manifest003.rdf", FB | MICRO | MINI), new TestDef("I5.1/Manifest001.rdf", FB | MINI), - + new TestDef("rdf-charmod-uris/Manifest.rdf", FB | MICRO | MINI), new TestDef("I4.6/Manifest003.rdf", FB | MICRO | MINI), new TestDef("I5.5/Manifest001.rdf", FB | MICRO | MINI), @@ -116,7 +116,7 @@ public class OWLUnitTest extends TestCase { // owl:Nothing new TestDef("I5.2/Manifest002.rdf", FB | MINI), - + // Disjointness tests new TestDef("differentFrom/Manifest001.rdf", FB | MICRO | MINI), new TestDef("disjointWith/Manifest001.rdf", FB | MICRO | MINI), @@ -138,18 +138,18 @@ public class OWLUnitTest extends TestCase { new TestDef("I5.24/Manifest003-mod.rdf", FB | MICRO | MINI), new TestDef("cardinality/Manifest005-mod.rdf", FB | MINI), new TestDef("cardinality/Manifest006-mod.rdf", FB | MINI), - + new TestDef("localtests/ManifestHv1.rdf", FB | MINI | MICRO), new TestDef("localtests/ManifestHv2.rdf", FB | MINI | MICRO), - + // Needs bNode creation rule new TestDef("someValuesFrom/Manifest001.rdf", FB ), - + // New local tests new TestDef("localtests/Manifest003.rdf", FB | MICRO | MINI), new TestDef("localtests/Manifest004.rdf", FB | MINI), // Requires equality new TestDef("localtests/Manifest006.rdf", FB ), // a oneOF case - + // Inheritance of domain/range by subProperties, inverseof new TestDef("localtests/Manifest007.rdf", FB | MICRO | MINI), new TestDef("localtests/Manifest008.rdf", FB | MICRO | MINI), @@ -158,7 +158,7 @@ public class OWLUnitTest extends TestCase { // clean case new TestDef(new OWLConsistencyTest("tbox.owl", "consistentData.rdf", CLEAN, null), FB | MICRO | MINI), // Instance of disjoint classes - new TestDef(new OWLConsistencyTest("tbox.owl", "inconsistent1.rdf", INCONSISTENT, + new TestDef(new OWLConsistencyTest("tbox.owl", "inconsistent1.rdf", INCONSISTENT, ResourceFactory.createResource("http://jena.hpl.hp.com/testing/reasoners/owl#ia")), FB | MICRO | MINI), // Type violation new TestDef(new OWLConsistencyTest("tbox.owl", "inconsistent2.rdf", INCONSISTENT, null), FB | MICRO | MINI), @@ -170,7 +170,7 @@ public class OWLUnitTest extends TestCase { new TestDef(new OWLConsistencyTest("tbox.owl", "inconsistent6.rdf", INCONSISTENT, null), FB | MINI), // Type clash - allValuesFrom rdfs:Literal new TestDef(new OWLConsistencyTest("tbox.owl", "inconsistent5.rdf", INCONSISTENT, null), FB | MICRO | MINI), - // Intersection of disjoint classes + // Intersection of disjoint classes new TestDef(new OWLConsistencyTest("tbox.owl", "emptyClass1.rdf", WARNINGS, null), FB | MICRO | MINI), // Equivalent to Nothing new TestDef(new OWLConsistencyTest("tbox.owl", "emptyClass2.rdf", WARNINGS, null), FB | MICRO | MINI), @@ -178,23 +178,23 @@ public class OWLUnitTest extends TestCase { new TestDef(new OWLConsistencyTest("tbox.owl", "emptyClass3.rdf", WARNINGS, null), FB | MICRO | MINI), }; -// -------------- instance variables for a single test ---------------------- +// -------------- instance variables for a single test ---------------------- /** The name of the manifest file to test */ protected String manifest; - + /** The reasoner factory under test */ protected ReasonerFactory reasonerFactory; - + /** * Boilerplate for junit - */ + */ public OWLUnitTest( String manifest, String rName, ReasonerFactory rf) { - super( rName + ":" + manifest ); + super( rName + ":" + manifest ); this.manifest = manifest; this.reasonerFactory = rf; } - + /** * Boilerplate for junit. * This is its own test suite @@ -222,7 +222,7 @@ public class OWLUnitTest extends TestCase { } return suite; } - + /** * The test runner */ @@ -232,24 +232,24 @@ public class OWLUnitTest extends TestCase { OWLWGTester tester = new OWLWGTester(reasonerFactory, this, null); tester.runTests(manifest, false, false); } - + /** * Inner class - use to represent a single test case and which reasoners * it is relevant to. */ static class TestDef { /** Test spec, could be a the relative URI for a manifest, or a consistecy test object */ - public Object spec; - + public Object spec; + /** Bitmap of the reasoners this test is relevant to */ public int validFor; - + /** Constructor */ public TestDef(Object spec, int validFor) { this.spec = spec; this.validFor = validFor; } - + /** Return the bitflag corresponding to the given reasoner factory */ public int flagFor(ReasonerFactory rf) { if (rf.equals(OWLFBRuleReasonerFactory.theInstance())) { @@ -262,11 +262,11 @@ public class OWLUnitTest extends TestCase { throw new ReasonerException("Unrecognized OWL reasoner config in unit test"); } } - + /** Return true if the test is relevant to this reasoner factory */ public boolean applicableTo(ReasonerFactory rf) { return (validFor & flagFor(rf)) != 0; } } - + } diff --git a/jena-core/testing/ontology/owl/list-syntax/owlDemoSchema.xml b/jena-core/testing/ontology/owl/list-syntax/owlDemoSchema.xml index 427a143a8e..574d4a336e 100644 --- a/jena-core/testing/ontology/owl/list-syntax/owlDemoSchema.xml +++ b/jena-core/testing/ontology/owl/list-syntax/owlDemoSchema.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg/'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> @@ -9,7 +9,7 @@ ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" xmlns:owl="&owl;" - xml:base="urn:x-hp:eg/" xmlns:eg="⪚" xmlns="⪚"> + xml:base="⪚" xmlns:eg="⪚" xmlns="⪚"> <owl:Class rdf:about="⪚Computer"> <rdfs:subClassOf> diff --git a/jena-core/testing/wg/localtests/conclusions003.rdf b/jena-core/testing/wg/localtests/conclusions003.rdf index 016ae55390..d6c0c9b726 100644 --- a/jena-core/testing/wg/localtests/conclusions003.rdf +++ b/jena-core/testing/wg/localtests/conclusions003.rdf @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg/'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> @@ -9,7 +9,7 @@ ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" xmlns:owl="&owl;" - xml:base="urn:x-hp:eg/" xmlns="⪚"> + xml:base="⪚" xmlns="⪚"> <Computer rdf:about="⪚whiteBoxZX"> <rdf:type rdf:resource="⪚GamingComputer" /> diff --git a/jena-core/testing/wg/localtests/conclusions004.rdf b/jena-core/testing/wg/localtests/conclusions004.rdf index 84c4f1afcd..9277343bcf 100644 --- a/jena-core/testing/wg/localtests/conclusions004.rdf +++ b/jena-core/testing/wg/localtests/conclusions004.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/conclusions005.rdf b/jena-core/testing/wg/localtests/conclusions005.rdf index c8c65082ff..3d5eda89ea 100644 --- a/jena-core/testing/wg/localtests/conclusions005.rdf +++ b/jena-core/testing/wg/localtests/conclusions005.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/conclusions006.rdf b/jena-core/testing/wg/localtests/conclusions006.rdf index 84c221d9df..8f3e0eab5f 100644 --- a/jena-core/testing/wg/localtests/conclusions006.rdf +++ b/jena-core/testing/wg/localtests/conclusions006.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/conclusions007.rdf b/jena-core/testing/wg/localtests/conclusions007.rdf index 94bfc7ec67..0ebf124551 100644 --- a/jena-core/testing/wg/localtests/conclusions007.rdf +++ b/jena-core/testing/wg/localtests/conclusions007.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/conclusions008.rdf b/jena-core/testing/wg/localtests/conclusions008.rdf index 4aec7e5dd1..c678b5624a 100644 --- a/jena-core/testing/wg/localtests/conclusions008.rdf +++ b/jena-core/testing/wg/localtests/conclusions008.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/premises003.rdf b/jena-core/testing/wg/localtests/premises003.rdf index d91739a45e..8be1da9a2b 100644 --- a/jena-core/testing/wg/localtests/premises003.rdf +++ b/jena-core/testing/wg/localtests/premises003.rdf @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg/'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> @@ -9,7 +9,7 @@ ]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:rdfs="&rdfs;" xmlns:xsd="&xsd;" xmlns:owl="&owl;" - xml:base="urn:x-hp:eg/" xmlns="⪚"> + xml:base="⪚" xmlns="⪚"> <owl:Class rdf:about="⪚Computer"> <rdfs:subClassOf> diff --git a/jena-core/testing/wg/localtests/premises004.rdf b/jena-core/testing/wg/localtests/premises004.rdf index a25cbe6387..991d95aaf1 100644 --- a/jena-core/testing/wg/localtests/premises004.rdf +++ b/jena-core/testing/wg/localtests/premises004.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/premises005.rdf b/jena-core/testing/wg/localtests/premises005.rdf index 72d47bd954..f2486846a7 100644 --- a/jena-core/testing/wg/localtests/premises005.rdf +++ b/jena-core/testing/wg/localtests/premises005.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/premises006.rdf b/jena-core/testing/wg/localtests/premises006.rdf index 2e5e987b81..5b619aaaa6 100644 --- a/jena-core/testing/wg/localtests/premises006.rdf +++ b/jena-core/testing/wg/localtests/premises006.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/premises007.rdf b/jena-core/testing/wg/localtests/premises007.rdf index 8c530be6e5..310121b35f 100644 --- a/jena-core/testing/wg/localtests/premises007.rdf +++ b/jena-core/testing/wg/localtests/premises007.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'> diff --git a/jena-core/testing/wg/localtests/premises008.rdf b/jena-core/testing/wg/localtests/premises008.rdf index f85c1f591c..adf7084c78 100644 --- a/jena-core/testing/wg/localtests/premises008.rdf +++ b/jena-core/testing/wg/localtests/premises008.rdf @@ -6,7 +6,7 @@ --> <!DOCTYPE rdf:RDF [ - <!ENTITY eg 'urn:x-hp:eg'> + <!ENTITY eg 'urn:x-hp:eg_'> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xsd 'http://www.w3.org/2001/XMLSchema#'>
