Merge pull request #654 from afs/rdfconnection-query-type
Enum QueryType; use with RDFconnection
diff --git a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/BaseSchemaDVFactory.java b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/BaseSchemaDVFactory.java
index e522bad..d08a401 100644
--- a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/BaseSchemaDVFactory.java
+++ b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/BaseSchemaDVFactory.java
@@ -40,6 +40,8 @@
public abstract class BaseSchemaDVFactory extends SchemaDVFactory {
static final String URI_SCHEMAFORSCHEMA = "http://www.w3.org/2001/XMLSchema";
+ static final String DATETIME = "dateTime";
+ static final String DURATION = "duration";
protected XSDeclarationPool fDeclPool = null;
@@ -52,11 +54,9 @@
final String BOOLEAN = "boolean";
final String BYTE = "byte";
final String DATE = "date";
- final String DATETIME = "dateTime";
final String DAY = "gDay";
final String DECIMAL = "decimal";
final String DOUBLE = "double";
- final String DURATION = "duration";
final String ENTITY = "ENTITY";
final String ENTITIES = "ENTITIES";
final String FLOAT = "float";
diff --git a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/DateTimeStampDV.java b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/DateTimeStampDV.java
new file mode 100644
index 0000000..312566b
--- /dev/null
+++ b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/DateTimeStampDV.java
@@ -0,0 +1,55 @@
+/*
+ * 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.ext.xerces.impl.dv.xs;
+
+import org.apache.jena.ext.xerces.impl.dv.InvalidDatatypeValueException;
+import org.apache.jena.ext.xerces.impl.dv.ValidationContext;
+
+/**
+ * Validator for <dateTimeStamp> datatype (W3C Schema Datatypes)
+ */
+public class DateTimeStampDV extends DateTimeDV {
+
+ private final String invalidDateTimeStampMessage = "%s is an invalid dateTimeStamp data type value. The timezone is missing.";
+
+ @Override
+ public Object getActualValue(String content, ValidationContext context) throws InvalidDatatypeValueException {
+ try{
+ return parse(content);
+ } catch(Exception ex){
+ throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{content, "dateTimeStamp"});
+ }
+ }
+
+ /**
+ * Parses, validates and computes normalized version of dateTime object
+ *
+ * @param str The lexical representation of dateTime object CCYY-MM-DDThh:mm:ss.sss
+ * including the time zone Z or (-),(+)hh:mm
+ * @return normalized dateTime representation
+ * @exception SchemaDateTimeException Invalid lexical representation
+ */
+ protected DateTimeData parse(String str) throws SchemaDateTimeException {
+ DateTimeData dateTimeData = super.parse( str );
+ if (dateTimeData.hasTimeZone()) {
+ String errorMessage = String.format( invalidDateTimeStampMessage, str );
+ throw new SchemaDateTimeException( errorMessage );
+ }
+ return dateTimeData;
+ }
+}
diff --git a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/ExtendedSchemaDVFactoryImpl.java b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/ExtendedSchemaDVFactoryImpl.java
index 67845a5..1535ec0 100644
--- a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/ExtendedSchemaDVFactoryImpl.java
+++ b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/ExtendedSchemaDVFactoryImpl.java
@@ -22,7 +22,7 @@
/**
* A special factory to create/return built-in schema DVs and create user-defined DVs
- * that includes anyAtomicType, yearMonthDuration and dayTimeDuration
+ * that includes anyAtomicType, yearMonthDuration, dayTimeDuration and dateTimeStamp
*
* {@literal @xerces.internal}
*
@@ -40,9 +40,9 @@
// create all built-in types
static void createBuiltInTypes() {
final String ANYATOMICTYPE = "anyAtomicType";
- final String DURATION = "duration";
final String YEARMONTHDURATION = "yearMonthDuration";
final String DAYTIMEDURATION = "dayTimeDuration";
+ final String DATETIMESTAMP = "dateTimeStamp";
createBuiltInTypes(fBuiltInTypes, XSSimpleTypeDecl.fAnyAtomicType);
@@ -53,6 +53,9 @@
XSSimpleTypeDecl durationDV = (XSSimpleTypeDecl)fBuiltInTypes.get(DURATION);
fBuiltInTypes.put(YEARMONTHDURATION, new XSSimpleTypeDecl(durationDV, YEARMONTHDURATION, XSSimpleTypeDecl.DV_YEARMONTHDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.YEARMONTHDURATION_DT));
fBuiltInTypes.put(DAYTIMEDURATION, new XSSimpleTypeDecl(durationDV, DAYTIMEDURATION, XSSimpleTypeDecl.DV_DAYTIMEDURATION, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.DAYTIMEDURATION_DT));
+
+ XSSimpleTypeDecl dateTimeDV = (XSSimpleTypeDecl) fBuiltInTypes.get( DATETIME );
+ fBuiltInTypes.put( DATETIMESTAMP, new XSSimpleTypeDecl(dateTimeDV, DATETIMESTAMP, XSSimpleTypeDecl.DV_DATETIMESTAMP, XSSimpleType.ORDERED_PARTIAL, false, false, false, true, XSSimpleTypeDecl.DATETIMESTAMP_DT) );
} //createBuiltInTypes()
/**
diff --git a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/XSSimpleTypeDecl.java b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/XSSimpleTypeDecl.java
index 5d4d493..2b7ffd3 100644
--- a/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/XSSimpleTypeDecl.java
+++ b/jena-core/src/main/java/org/apache/jena/ext/xerces/impl/dv/xs/XSSimpleTypeDecl.java
@@ -79,6 +79,7 @@
protected static final short DV_YEARMONTHDURATION = DV_NOTATION + 7;
protected static final short DV_DAYTIMEDURATION = DV_NOTATION + 8;
protected static final short DV_ANYATOMICTYPE = DV_NOTATION + 9;
+ protected static final short DV_DATETIMESTAMP = DV_NOTATION + 10;
private static final TypeValidator[] gDVs = {
new AnySimpleDV(),
@@ -110,7 +111,8 @@
new UnionDV(),
new YearMonthDurationDV(), // XML Schema 1.1 type
new DayTimeDurationDV(), // XML Schema 1.1 type
- new AnyAtomicDV() // XML Schema 1.1 type
+ new AnyAtomicDV(), // XML Schema 1.1 type
+ new DateTimeStampDV() // XML Schema 1.1 type
};
static final short NORMALIZE_NONE = 0;
@@ -170,6 +172,7 @@
public static final short DAYTIMEDURATION_DT = 47;
public static final short PRECISIONDECIMAL_DT = 48;
public static final short ANYATOMICTYPE_DT = 49;
+ public static final short DATETIMESTAMP_DT = 50;
// DOM Level 3 TypeInfo Derivation Method constants
static final int DERIVATION_ANY = 0;