diff --git a/pom.xml b/pom.xml index a2ed764f..9fbc66f3 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ io.sirix brackit - 0.4-SNAPSHOT + 0.5-SNAPSHOT Brackit Engine UTF-8 @@ -85,7 +85,7 @@ org.apache.maven.plugins maven-jar-plugin - 2.6 + 3.0.0 diff --git a/src/main/java/io/brackit/query/ErrorCode.java b/src/main/java/io/brackit/query/ErrorCode.java index af8f1597..17e4f5fd 100644 --- a/src/main/java/io/brackit/query/ErrorCode.java +++ b/src/main/java/io/brackit/query/ErrorCode.java @@ -45,17 +45,23 @@ public class ErrorCode { /** * err:FONS0004 */ - public static final QNm ERR_NO_NAMESPACE_FOR_PREFIX = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FONS0004"); + public static final QNm ERR_NO_NAMESPACE_FOR_PREFIX = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FONS0004"); /** * err:XPDY0002 */ - public static final QNm ERR_DYNAMIC_CONTEXT_VARIABLE_NOT_DEFINED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPDY0002"); + public static final QNm ERR_DYNAMIC_CONTEXT_VARIABLE_NOT_DEFINED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPDY0002"); /** * err:XPDY0050 */ - public static final QNm ERR_DYNAMIC_TYPE_DOES_NOT_MATCH_TREAT_TYPE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPDY0050"); + public static final QNm ERR_DYNAMIC_TYPE_DOES_NOT_MATCH_TREAT_TYPE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPDY0050"); /** * err:XPDY0003 @@ -65,27 +71,37 @@ public class ErrorCode { /** * err:XPTY0004 */ - public static final QNm ERR_TYPE_INAPPROPRIATE_TYPE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPTY0004"); + public static final QNm ERR_TYPE_INAPPROPRIATE_TYPE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPTY0004"); /** * err:XPTY0018 */ - public static final QNm ERR_PATH_STEP_RETURNED_NODE_AND_NON_NODE_VALUES = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPTY0018"); + public static final QNm ERR_PATH_STEP_RETURNED_NODE_AND_NON_NODE_VALUES = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPTY0018"); /** * err:XPTY0019 */ - public static final QNm ERR_PATH_STEP_RETURNED_NON_NODE_VALUE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPTY0019"); + public static final QNm ERR_PATH_STEP_RETURNED_NON_NODE_VALUE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPTY0019"); /** * err:XPTY0020 */ - public static final QNm ERR_PATH_STEP_CONTEXT_ITEM_IS_NOT_A_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPTY0020"); + public static final QNm ERR_PATH_STEP_CONTEXT_ITEM_IS_NOT_A_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPTY0020"); /** * err:XPTY0117 */ - public static final QNm ERR_TYPE_CAST_TO_NAMESPACE_SENSITIVE_TYPE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPTY0117"); + public static final QNm ERR_TYPE_CAST_TO_NAMESPACE_SENSITIVE_TYPE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPTY0117"); /** * err:XQTY0024 @@ -102,17 +118,23 @@ public class ErrorCode { /** * err:XPST0051 */ - public static final QNm ERR_UNKNOWN_ATOMIC_SCHEMA_TYPE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPST0051"); + public static final QNm ERR_UNKNOWN_ATOMIC_SCHEMA_TYPE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPST0051"); /** * err:PST0080 */ - public static final QNm ERR_ILLEGAL_CAST_TARGET_TYPE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPST0080"); + public static final QNm ERR_ILLEGAL_CAST_TARGET_TYPE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPST0080"); /** * err:PST0081 */ - public static final QNm ERR_UNDEFINED_NAMESPACE_PREFIX = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XPST0081"); + public static final QNm ERR_UNDEFINED_NAMESPACE_PREFIX = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XPST0081"); /** * err:XPST0017 @@ -122,7 +144,9 @@ public class ErrorCode { /** * err:XQST0009 */ - public static final QNm ERR_SCHEMA_IMPORT_FEATURE_NOT_SUPPORTED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0009"); + public static final QNm ERR_SCHEMA_IMPORT_FEATURE_NOT_SUPPORTED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0009"); /** * err:XQST0016 @@ -134,32 +158,44 @@ public class ErrorCode { /** * err:XQST0040 */ - public static final QNm ERR_ENCLOSED_EXPR_IN_NS_ATTRIBUTE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0040"); + public static final QNm ERR_ENCLOSED_EXPR_IN_NS_ATTRIBUTE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0040"); /** * err:XQST0032 */ - public static final QNm ERR_BASE_URI_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0032"); + public static final QNm ERR_BASE_URI_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0032"); /** * err:XQST0033 */ - public static final QNm ERR_MULTIPLE_NS_BINDINGS_FOR_PREFIX = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0033"); + public static final QNm ERR_MULTIPLE_NS_BINDINGS_FOR_PREFIX = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0033"); /** * err:XQST0034 */ - public static final QNm ERR_MULTIPLE_FUNCTION_DECLARATIONS = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0034"); + public static final QNm ERR_MULTIPLE_FUNCTION_DECLARATIONS = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0034"); /** * err:XQST0039 */ - public static final QNm ERR_DUPLICATE_FUN_PARAMETER = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0039"); + public static final QNm ERR_DUPLICATE_FUN_PARAMETER = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0039"); /** * err:XQST0045 */ - public static final QNm ERR_FUNCTION_DECL_IN_ILLEGAL_NAMESPACE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0045"); + public static final QNm ERR_FUNCTION_DECL_IN_ILLEGAL_NAMESPACE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0045"); /** * err:XQST0046 @@ -169,62 +205,86 @@ public class ErrorCode { /** * err:XQST0047 */ - public static final QNm ERR_MULTIPLE_IMPORTS_IN_SAME_NS = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0047"); + public static final QNm ERR_MULTIPLE_IMPORTS_IN_SAME_NS = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0047"); /** * err:XQST0048 */ - public static final QNm ERR_FUN_OR_VAR_NOT_IN_TARGET_NS = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0048"); + public static final QNm ERR_FUN_OR_VAR_NOT_IN_TARGET_NS = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0048"); /** * err:XQST0049 */ - public static final QNm ERR_DUPLICATE_VARIABLE_DECL = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0049"); + public static final QNm ERR_DUPLICATE_VARIABLE_DECL = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0049"); /** * err:XQST0054 */ - public static final QNm ERR_CIRCULAR_VARIABLE_DEPENDENCY = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0054"); + public static final QNm ERR_CIRCULAR_VARIABLE_DEPENDENCY = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0054"); /** * err:XQST0055 */ - public static final QNm ERR_COPY_NAMESPACES_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0055"); + public static final QNm ERR_COPY_NAMESPACES_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0055"); /** * err:XQST0059 */ - public static final QNm ERR_SCHEMA_OR_MODULE_NOT_FOUND = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0059"); + public static final QNm ERR_SCHEMA_OR_MODULE_NOT_FOUND = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0059"); /** * err:XQST0060 */ - public static final QNm ERR_FUNCTION_DECL_NOT_IN_NS = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0060"); + public static final QNm ERR_FUNCTION_DECL_NOT_IN_NS = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0060"); /** * err:XQST0065 */ - public static final QNm ERR_ORDERING_MODE_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0065"); + public static final QNm ERR_ORDERING_MODE_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0065"); /** * err:XQST0066 */ - public static final QNm ERR_DEFAULT_NS_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0066"); + public static final QNm ERR_DEFAULT_NS_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0066"); /** * err:XQST0067 */ - public static final QNm ERR_CONSTRUCTION_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0067"); + public static final QNm ERR_CONSTRUCTION_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0067"); /** * err:XQST0068 */ - public static final QNm ERR_BOUNDARY_SPACE_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0068"); + public static final QNm ERR_BOUNDARY_SPACE_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0068"); /** * err:XQST0069 */ - public static final QNm ERR_EMPTY_ORDER_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0069"); + public static final QNm ERR_EMPTY_ORDER_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0069"); /** * err:XQST0070 @@ -234,17 +294,23 @@ public class ErrorCode { /** * err:XQDY0074 */ - public static final QNm ERR_UNKNOWN_NS_PREFIX_IN_COMP_CONSTR = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQDY0074"); + public static final QNm ERR_UNKNOWN_NS_PREFIX_IN_COMP_CONSTR = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQDY0074"); /** * err:XQST0075 */ - public static final QNm ERR_SCHEMA_VALIDATION_FEATURE_NOT_SUPPORTED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0075"); + public static final QNm ERR_SCHEMA_VALIDATION_FEATURE_NOT_SUPPORTED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0075"); /** * err:XQST0076 */ - public static final QNm ERR_UNKNOWN_COLLATION_IN_FLWOR_CLAUSE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0076"); + public static final QNm ERR_UNKNOWN_COLLATION_IN_FLWOR_CLAUSE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0076"); /** * err:XQST0088 @@ -254,42 +320,58 @@ public class ErrorCode { /** * err:XQST0089 */ - public static final QNm ERR_FOR_VAR_AND_POS_VAR_EQUAL = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0089"); + public static final QNm ERR_FOR_VAR_AND_POS_VAR_EQUAL = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0089"); /** * err:XQST0090 */ - public static final QNm ERR_UNDEFINED_CHARACTER_REFERENCE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0090"); + public static final QNm ERR_UNDEFINED_CHARACTER_REFERENCE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0090"); /** * err:XQST0099 */ - public static final QNm ERR_CONTEXT_ITEM_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0099"); + public static final QNm ERR_CONTEXT_ITEM_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0099"); /** * err:XQST0106 */ - public static QNm ERR_FUN_PRIVATE_OR_PUBLIC_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0106"); + public static QNm ERR_FUN_PRIVATE_OR_PUBLIC_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0106"); /** * err:XQST0107 */ - public static final QNm ERR_CIRCULAR_CONTEXT_ITEM_INITIALIZER = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0107"); + public static final QNm ERR_CIRCULAR_CONTEXT_ITEM_INITIALIZER = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0107"); /** * err:XQST0113 */ - public static QNm ERR_CONTEXT_ITEM_VALUE_SPEC_IN_LIBRARY = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0113"); + public static QNm ERR_CONTEXT_ITEM_VALUE_SPEC_IN_LIBRARY = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0113"); /** * err:XQST0114 */ - public static QNm ERR_DECIMAL_FORMAT_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0114"); + public static QNm ERR_DECIMAL_FORMAT_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0114"); /** * err:XQST0116 */ - public static QNm ERR_VAR_PRIVATE_OR_PUBLIC_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQST0116"); + public static QNm ERR_VAR_PRIVATE_OR_PUBLIC_ALREADY_DECLARED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQST0116"); /** * err:FOAR0001 @@ -309,7 +391,9 @@ public class ErrorCode { /** * err:FOAR0002 */ - public static final QNm ERR_NUMERIC_OVERFLOW_UNDERFLOW = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FOAR0002"); + public static final QNm ERR_NUMERIC_OVERFLOW_UNDERFLOW = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FOAR0002"); /** * err:FOCH0001 @@ -334,12 +418,16 @@ public class ErrorCode { /** * err:FODT0001 */ - public static final QNm ERR_OVERFLOW_UNDERFLOW_IN_DATETIME = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FODT0001"); + public static final QNm ERR_OVERFLOW_UNDERFLOW_IN_DATETIME = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FODT0001"); /** * err:FODT0002 */ - public static final QNm ERR_OVERFLOW_UNDERFLOW_IN_DURATION = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FODT0002"); + public static final QNm ERR_OVERFLOW_UNDERFLOW_IN_DURATION = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FODT0002"); /** * err:FODT0003 @@ -354,7 +442,9 @@ public class ErrorCode { /** * err:FONS0005 */ - public static final QNm ERR_UNDEFINED_STATIC_BASE_URI = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FONS0005"); + public static final QNm ERR_UNDEFINED_STATIC_BASE_URI = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FONS0005"); /** * err:FORG0001 @@ -389,7 +479,9 @@ public class ErrorCode { /** * err:FORG0008 */ - public static final QNm ERR_DATETIME_FUNCTION_DIFFERENT_TZ = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FORG0008"); + public static final QNm ERR_DATETIME_FUNCTION_DIFFERENT_TZ = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FORG0008"); /** * err:FORG0009 @@ -399,91 +491,127 @@ public class ErrorCode { /** * err:FORX0001 */ - public static final QNm ERR_INVALID_REGULAR_EXPRESSION_FLAGS = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FORX0001"); + public static final QNm ERR_INVALID_REGULAR_EXPRESSION_FLAGS = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FORX0001"); /** * err:FORX0002 */ - public static final QNm ERR_INVALID_REGULAR_EXPRESSION = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FORX0002"); + public static final QNm ERR_INVALID_REGULAR_EXPRESSION = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FORX0002"); /** * err:FORX0003 */ - public static final QNm ERR_REGULAR_EXPRESSION_EMPTY_STRING = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FORX0003"); + public static final QNm ERR_REGULAR_EXPRESSION_EMPTY_STRING = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FORX0003"); /** * err:FORX0004 */ - public static final QNm ERR_INVALID_REPLACEMENT_STRING = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FORX0004"); + public static final QNm ERR_INVALID_REPLACEMENT_STRING = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FORX0004"); /** * err:FOTY0012 */ - public static final QNm ERR_ITEM_HAS_NO_TYPED_VALUE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "FOTY0012"); + public static final QNm ERR_ITEM_HAS_NO_TYPED_VALUE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "FOTY0012"); /** * err:SENR0001 */ - public static final QNm ERR_SERIALIZE_ATTRIBUTE_OR_NAMESPACE_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "SENR0001"); + public static final QNm ERR_SERIALIZE_ATTRIBUTE_OR_NAMESPACE_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "SENR0001"); /** * err:XUST0001 */ - public static final QNm ERR_UPDATE_ILLEGAL_NESTED_UPDATE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUST0001"); + public static final QNm ERR_UPDATE_ILLEGAL_NESTED_UPDATE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUST0001"); /** * err:XUST0002 */ - public static final QNm ERR_UPDATING_OR_VACUOUS_EXPR_REQUIRED = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUST0002"); + public static final QNm ERR_UPDATING_OR_VACUOUS_EXPR_REQUIRED = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUST0002"); /** * err:XUDY0009 */ - public static final QNm ERR_UPDATE_REPLACE_TARGET_NODE_HAS_NO_PARENT = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0009"); + public static final QNm ERR_UPDATE_REPLACE_TARGET_NODE_HAS_NO_PARENT = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0009"); /** * err:XUDY0014 */ - public static final QNm ERR_TRANSFORM_MODIFIES_EXISTING_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0014"); + public static final QNm ERR_TRANSFORM_MODIFIES_EXISTING_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0014"); /** * err:XUDY0015 */ - public static final QNm ERR_UPDATE_DUPLICATE_RENAME_TARGET = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0015"); + public static final QNm ERR_UPDATE_DUPLICATE_RENAME_TARGET = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0015"); /** * err:XUDY0016 */ - public static final QNm ERR_UPDATE_DUPLICATE_REPLACE_NODE_TARGET = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0016"); + public static final QNm ERR_UPDATE_DUPLICATE_REPLACE_NODE_TARGET = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0016"); /** * err:XUDY0017 */ - public static final QNm ERR_UPDATE_DUPLICATE_REPLACE_VALUE_TARGET = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0017"); + public static final QNm ERR_UPDATE_DUPLICATE_REPLACE_VALUE_TARGET = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0017"); /** * err:XUDY0027 */ - public static final QNm ERR_UPDATE_INSERT_TARGET_IS_EMPTY_SEQUENCE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0027"); + public static final QNm ERR_UPDATE_INSERT_TARGET_IS_EMPTY_SEQUENCE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0027"); /** * err:XUTY0005 */ - public static final QNm ERR_UPDATE_INSERT_TARGET_NOT_A_SINGLE_ED_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0005"); + public static final QNm ERR_UPDATE_INSERT_TARGET_NOT_A_SINGLE_ED_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0005"); /** * err:XUTY0006 */ - public static final QNm ERR_UPDATE_INSERT_TARGET_NOT_A_SINGLE_ETCP_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0006"); + public static final QNm ERR_UPDATE_INSERT_TARGET_NOT_A_SINGLE_ETCP_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0006"); /** * err:XUTY0007 */ - public static final QNm ERR_UPDATE_DELETE_TARGET_NOT_A_NODE_SEQUENCE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0007"); + public static final QNm ERR_UPDATE_DELETE_TARGET_NOT_A_NODE_SEQUENCE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0007"); /** * err:XUTY0008 */ - public static final QNm ERR_UPDATE_REPLACE_TARGET_NOT_A_EATCP_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0008"); + public static final QNm ERR_UPDATE_REPLACE_TARGET_NOT_A_EATCP_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0008"); /** * err:XUTY0010 @@ -502,22 +630,30 @@ public class ErrorCode { /** * err:XUTY0012 */ - public static final QNm ERR_UPDATE_RENAME_TARGET_NOT_A_EAP_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0012"); + public static final QNm ERR_UPDATE_RENAME_TARGET_NOT_A_EAP_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0012"); /** * err:XUTY0013 */ - public static final QNm ERR_TRANSFORM_SOURCE_EXPRESSION_NOT_SINGLE_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0013"); + public static final QNm ERR_TRANSFORM_SOURCE_EXPRESSION_NOT_SINGLE_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0013"); /** * err:XUTY0022 */ - public static final QNm ERR_UPDATE_INSERT_INTO_TARGET_IS_DOCUMENT_NODE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUTY0022"); + public static final QNm ERR_UPDATE_INSERT_INTO_TARGET_IS_DOCUMENT_NODE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUTY0022"); /** * err:XUDY0029 */ - public static final QNm ERR_UPDATE_INSERT_TARGET_NODE_HAS_NO_PARENT = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XUDY0029"); + public static final QNm ERR_UPDATE_INSERT_TARGET_NODE_HAS_NO_PARENT = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XUDY0029"); /** * err:XUDY0030 @@ -529,17 +665,23 @@ public class ErrorCode { /** * err:XQDY0026 */ - public static final QNm ERR_PI_WOULD_CONTAIN_ILLEGAL_STRING = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQDY0026"); + public static final QNm ERR_PI_WOULD_CONTAIN_ILLEGAL_STRING = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQDY0026"); /** * err:XQDY0041 */ - public static final QNm ERR_PI_TARGET_CAST_TO_NCNAME = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQDY0041"); + public static final QNm ERR_PI_TARGET_CAST_TO_NCNAME = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQDY0041"); /** * err:XQDY0044 */ - public static final QNm ERR_ILLEGAL_NAME_OF_CONSTRUCTED_ATTRIBUTE = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "err:XQDY0044"); + public static final QNm ERR_ILLEGAL_NAME_OF_CONSTRUCTED_ATTRIBUTE = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "err:XQDY0044"); /** * err:XQDY0064 @@ -549,7 +691,9 @@ public class ErrorCode { /** * err:XQDY0072 */ - public static final QNm ERR_COMMENT_WOULD_CONTAIN_ILLEGAL_HYPHENS = new QNm(Namespaces.ERR_NSURI, Namespaces.ERR_PREFIX, "XQDY0072"); + public static final QNm ERR_COMMENT_WOULD_CONTAIN_ILLEGAL_HYPHENS = new QNm(Namespaces.ERR_NSURI, + Namespaces.ERR_PREFIX, + "XQDY0072"); /* * Error codes of the runtime. This should be placed in {@link Bits}, but diff --git a/src/main/java/io/brackit/query/compiler/optimizer/walker/topdown/GroupByAggregates.java b/src/main/java/io/brackit/query/compiler/optimizer/walker/topdown/GroupByAggregates.java index 7f790384..d3900437 100644 --- a/src/main/java/io/brackit/query/compiler/optimizer/walker/topdown/GroupByAggregates.java +++ b/src/main/java/io/brackit/query/compiler/optimizer/walker/topdown/GroupByAggregates.java @@ -220,8 +220,8 @@ protected Optimizer getOptimizer(Map options) { }; Query xq = new Query(cc, "let $x:= 1 " - + "let $y:= (for $a in (1 to 10) for $b in ($a to $a + 2) group by $b let $c := if ($x eq 1) then $b else () return ) " - + "return $y"); + + "let $y:= (for $a in (1 to 10) for $b in ($a to $a + 2) group by $b let $c := if ($x eq 1) then $b else () return ) " + + "return $y"); xq.prettyPrint(); xq.serialize(new BrackitQueryContext(), System.out); } diff --git a/src/main/java/io/brackit/query/compiler/parser/XQParser.java b/src/main/java/io/brackit/query/compiler/parser/XQParser.java index 00925cb0..789d7522 100644 --- a/src/main/java/io/brackit/query/compiler/parser/XQParser.java +++ b/src/main/java/io/brackit/query/compiler/parser/XQParser.java @@ -55,10 +55,9 @@ @SuppressWarnings("SameParameterValue") public class XQParser extends Tokenizer { - private static final String[] RESERVED_FUNC_NAMES = - new String[] { "attribute", "comment", "document-node", "element", "empty-sequence", "function", "if", "item", - "namespace-node", "node", "processing-instruction", "schema-attribute", "schema-element", "switch", "text", - "typeswitch, array, object" }; + private static final String[] RESERVED_FUNC_NAMES = new String[] { "attribute", "comment", "document-node", "element", + "empty-sequence", "function", "if", "item", "namespace-node", "node", "processing-instruction", + "schema-attribute", "schema-element", "switch", "text", "typeswitch, array, object" }; public class IllegalNestingException extends TokenizerException { private final String expected; @@ -712,9 +711,9 @@ private AST annotatedDecl() throws TokenizerException { } // perform look ahead if (laSkipWS(la, "%") == null && laSymSkipWS(la, "variable") == null && laSymSkipWS(la, "function") == null - // Begin XQuery Update Facility 1.0 + // Begin XQuery Update Facility 1.0 && laSymSkipWS(la, "updating") == null - // End XQuery Update Facility 1.0 + // End XQuery Update Facility 1.0 ) { return null; } @@ -3082,8 +3081,9 @@ private AST postFixExpr() throws TokenizerException { AST arrayAccess = new AST(XQ.ArrayAccess); arrayAccess.addChild(expr); if (index.getType() == XQ.ArithmeticExpr && index.getChild(1).getValue() instanceof Int32 int32Index - && int32Index.intValue() == -1 && index.getChild(2).getValue() instanceof Int32 int32Index2 - && int32Index2.intValue() > 0) { + && int32Index.intValue() == -1 && index.getChild(2).getValue() instanceof Int32 int32Index2 && int32Index2 + .intValue() + > 0) { index = new AST(XQ.Int, new Int32(-1 * int32Index2.intValue())); } arrayAccess.addChild(index); @@ -3438,8 +3438,8 @@ private AST commonContent() throws TokenizerException { private AST dirElementContent(boolean checkBoundaryWS) throws TokenizerException { Token la; - if (checkBoundaryWS && ((la = laSkipS("<")) != null || (la = laSkipS("{")) != null && la(la, "{") == null) - && (la = laS()) != null) { + if (checkBoundaryWS && ((la = laSkipS("<")) != null || (la = laSkipS("{")) != null && la(la, "{") == null) && (la = + laS()) != null) { consume(la); AST boundaryWS = new AST(XQ.Str, la.string()); boundaryWS.setProperty("boundaryWS", true); diff --git a/src/main/java/io/brackit/query/function/bit/Load.java b/src/main/java/io/brackit/query/function/bit/Load.java index 69810935..967ce2be 100644 --- a/src/main/java/io/brackit/query/function/bit/Load.java +++ b/src/main/java/io/brackit/query/function/bit/Load.java @@ -109,8 +109,7 @@ public Sequence execute(StaticContext sctx, QueryContext ctx, Sequence[] args) t } } - private void add(NodeStore store, NodeCollection coll, Sequence resources) - throws DocumentException, IOException { + private void add(NodeStore store, NodeCollection coll, Sequence resources) throws DocumentException, IOException { if (resources instanceof Atomic) { String r = ((Atomic) resources).stringValue(); coll.add(new DocumentParser(URIHandler.getInputStream(r))); @@ -124,8 +123,7 @@ private void add(NodeStore store, NodeCollection coll, Sequence resources) } } - private void create(NodeStore store, String name, Sequence resources) - throws DocumentException, IOException { + private void create(NodeStore store, String name, Sequence resources) throws DocumentException, IOException { if (resources instanceof Atomic) { String r = ((Atomic) resources).stringValue(); store.create(name, new DocumentParser(URIHandler.getInputStream(r))); diff --git a/src/main/java/io/brackit/query/function/bit/Store.java b/src/main/java/io/brackit/query/function/bit/Store.java index ad8b3047..4795cede 100644 --- a/src/main/java/io/brackit/query/function/bit/Store.java +++ b/src/main/java/io/brackit/query/function/bit/Store.java @@ -114,8 +114,7 @@ private void add(NodeCollection coll, Sequence nodes) throws DocumentExceptio } } - private void create(NodeStore store, String name, Sequence nodes) - throws DocumentException { + private void create(NodeStore store, String name, Sequence nodes) throws DocumentException { if (nodes instanceof Node n) { store.create(name, new NodeStoreParser(n)); } else { diff --git a/src/main/java/io/brackit/query/jdm/node/AbstractTemporalNode.java b/src/main/java/io/brackit/query/jdm/node/AbstractTemporalNode.java index 370f7353..9c459ccc 100644 --- a/src/main/java/io/brackit/query/jdm/node/AbstractTemporalNode.java +++ b/src/main/java/io/brackit/query/jdm/node/AbstractTemporalNode.java @@ -7,6 +7,6 @@ * * @author Johannes Lichtenberger */ -public abstract class AbstractTemporalNode> extends AbstractNode> - implements TemporalNode> { +public abstract class AbstractTemporalNode> extends + AbstractNode> implements TemporalNode> { } diff --git a/src/main/java/io/brackit/query/module/Functions.java b/src/main/java/io/brackit/query/module/Functions.java index a9897b74..315466b7 100644 --- a/src/main/java/io/brackit/query/module/Functions.java +++ b/src/main/java/io/brackit/query/module/Functions.java @@ -111,28 +111,19 @@ public final class Functions { // See XQuery Functions and Operators 3 The Error Function predefine(new Error(new QNm(Namespaces.FN_NSURI, Namespaces.FN_PREFIX, "error"), - new Signature(new SequenceType(AnyItemType.ANY, - Cardinality.Zero)))); + new Signature(new SequenceType(AnyItemType.ANY, Cardinality.Zero)))); predefine(new Error(new QNm(Namespaces.FN_NSURI, Namespaces.FN_PREFIX, "error"), - new Signature(new SequenceType(AnyItemType.ANY, - Cardinality.Zero), - new SequenceType(AtomicType.QNM, - Cardinality.One)))); + new Signature(new SequenceType(AnyItemType.ANY, Cardinality.Zero), + new SequenceType(AtomicType.QNM, Cardinality.One)))); predefine(new Error(new QNm(Namespaces.FN_NSURI, Namespaces.FN_PREFIX, "error"), - new Signature(new SequenceType(AnyItemType.ANY, - Cardinality.Zero), - new SequenceType(AtomicType.QNM, - Cardinality.ZeroOrOne), - new SequenceType(AtomicType.STR, - Cardinality.One)))); + new Signature(new SequenceType(AnyItemType.ANY, Cardinality.Zero), + new SequenceType(AtomicType.QNM, Cardinality.ZeroOrOne), + new SequenceType(AtomicType.STR, Cardinality.One)))); predefine(new Error(new QNm(Namespaces.FN_NSURI, Namespaces.FN_PREFIX, "error"), - new Signature(new SequenceType(AnyItemType.ANY, - Cardinality.Zero), - new SequenceType(AtomicType.QNM, - Cardinality.ZeroOrOne), - new SequenceType(AtomicType.STR, Cardinality.One), - new SequenceType(AnyItemType.ANY, - Cardinality.ZeroOrMany)))); + new Signature(new SequenceType(AnyItemType.ANY, Cardinality.Zero), + new SequenceType(AtomicType.QNM, Cardinality.ZeroOrOne), + new SequenceType(AtomicType.STR, Cardinality.One), + new SequenceType(AnyItemType.ANY, Cardinality.ZeroOrMany)))); // See XQuery Functions and Operators 4 Trace Function predefine(new Trace(new QNm(Namespaces.FN_NSURI, Namespaces.FN_PREFIX, "trace"), diff --git a/src/test/java/io/brackit/query/JsonTest.java b/src/test/java/io/brackit/query/JsonTest.java index 9242718d..0101dedb 100644 --- a/src/test/java/io/brackit/query/JsonTest.java +++ b/src/test/java/io/brackit/query/JsonTest.java @@ -60,16 +60,15 @@ public final class JsonTest extends XQueryBaseTest { private static final String USER_PROFILES_JSON = """ {"first_name":"Sammy","last_name":"Shark","location":"Ocean","websites":[{"description":"work","URL":"https://www.digitalocean.com/"},{"description":"tutorials","URL":"https://www.digitalocean.com/community/tutorials"}],"social_media":[{"description":"twitter","link":"https://twitter.com/digitalocean"},{"description":"facebook","link":"https://www.facebook.com/DigitalOceanCloudHosting"},{"description":"github","link":"https://github.com/digitalocean"}]} - """ - .strip(); + """.strip(); @Test public void testNoJsoniqUsingXQuerySyntax() throws IOException { - final var query =""" - xquery version "3.0"; - let $xml := bar - return $xml/foo[./text() eq 'bar'] - """; + final var query = """ + xquery version "3.0"; + let $xml := bar + return $xml/foo[./text() eq 'bar'] + """; final var result = query(query); assertEquals("", result); } diff --git a/src/test/java/io/brackit/query/UpdateFacilityTest.java b/src/test/java/io/brackit/query/UpdateFacilityTest.java index 44abf7b5..3f1bb7a1 100644 --- a/src/test/java/io/brackit/query/UpdateFacilityTest.java +++ b/src/test/java/io/brackit/query/UpdateFacilityTest.java @@ -115,7 +115,7 @@ public void transformIllegalExpressionSecond() { @Test public void transformModifyFirst() { Sequence res = new Query( - "copy $c := modify for $a in $c//a return replace node $a with return $c").execute(ctx); + "copy $c := modify for $a in $c//a return replace node $a with return $c").execute(ctx); Node a = ctx.getNodeFactory().element(new QNm("n")); a.append(Kind.ELEMENT, new QNm("b"), null); a.append(Kind.ELEMENT, new QNm("b"), null); @@ -135,7 +135,7 @@ public void transformModifySecond() { @Test public void transformTestTwoCopyVars() { Sequence res = new Query( - "let $f := return copy $m := $f, $n := $f, $o := $f modify delete node $n/b return ($m, $n)").execute(ctx); + "let $f := return copy $m := $f, $n := $f, $o := $f modify delete node $n/b return ($m, $n)").execute(ctx); Node a1 = ctx.getNodeFactory().element(new QNm("a")); a1.setAttribute(new QNm("att"), new Una("1")); a1.append(Kind.ELEMENT, new QNm("b"), null); diff --git a/src/test/java/io/brackit/query/compiler/LibraryModulesTest.java b/src/test/java/io/brackit/query/compiler/LibraryModulesTest.java index 44e22df6..921e0a1c 100644 --- a/src/test/java/io/brackit/query/compiler/LibraryModulesTest.java +++ b/src/test/java/io/brackit/query/compiler/LibraryModulesTest.java @@ -203,8 +203,8 @@ protected ModuleResolver getModuleResolver() { }; final Query xq = new Query(chain, - "" + "import module namespace left='left'; " - + "import module namespace right='right'; " + "right:foo() + left:foo()"); + "" + "import module namespace left='left'; " + "import module namespace right='right'; " + + "right:foo() + left:foo()"); Sequence result = xq.execute(ctx); ResultChecker.check(new Int32(3), result); } diff --git a/src/test/java/io/brackit/query/compiler/optimizer/JoinTest.java b/src/test/java/io/brackit/query/compiler/optimizer/JoinTest.java index 3b956475..88758699 100644 --- a/src/test/java/io/brackit/query/compiler/optimizer/JoinTest.java +++ b/src/test/java/io/brackit/query/compiler/optimizer/JoinTest.java @@ -51,8 +51,7 @@ public class JoinTest extends XQueryBaseTest { @Test public void simpleNestedFor() { - Sequence res = new Query("for $a in (1,2,3) " + "for $b in (2,3,4) " + "where $a = $b " + "return $a").execute( - ctx); + Sequence res = new Query("for $a in (1,2,3) " + "for $b in (2,3,4) " + "where $a = $b " + "return $a").execute(ctx); ResultChecker.dCheck(intSequence(2, 3), res); } diff --git a/src/test/java/io/brackit/query/compiler/optimizer/LetBindLiftTest.java b/src/test/java/io/brackit/query/compiler/optimizer/LetBindLiftTest.java index 1798f3a4..c69a8ab1 100644 --- a/src/test/java/io/brackit/query/compiler/optimizer/LetBindLiftTest.java +++ b/src/test/java/io/brackit/query/compiler/optimizer/LetBindLiftTest.java @@ -186,10 +186,10 @@ public void orderBy2() { @Test public void doubledNestedWithOrderBy() { - Sequence res = new Query("for $z in 1 " + "let $x := " + "for $a in (1 to 5) " + "let $b := " - + " for $c in (2,4) " + " let $f := if ($c) then (2,4) else () " + " order by $c " + " let $d := " - + " for $e in $f " + " let $g := 'ignore' " + " where $c = $a " + " return $e " + " return $d " - + "return ($a,$b) " + "return $x").execute(ctx); + Sequence res = new Query("for $z in 1 " + "let $x := " + "for $a in (1 to 5) " + "let $b := " + " for $c in (2,4) " + + " let $f := if ($c) then (2,4) else () " + " order by $c " + " let $d := " + " for $e in $f " + + " let $g := 'ignore' " + " where $c = $a " + " return $e " + " return $d " + "return ($a,$b) " + + "return $x").execute(ctx); ResultChecker.dCheck(intSequence(1, 2, 2, 4, 3, 4, 2, 4, 5), res); } diff --git a/src/test/java/io/brackit/query/expr/CastTest.java b/src/test/java/io/brackit/query/expr/CastTest.java index f44b0f0a..fc871209 100644 --- a/src/test/java/io/brackit/query/expr/CastTest.java +++ b/src/test/java/io/brackit/query/expr/CastTest.java @@ -107,22 +107,21 @@ public void divideDayTimeDuration() { @Test public void dateTimeAddYearMonthDuration() { - Sequence res = new Query("xs:dateTime('1981-12-31T12:05:35.1234567') + xs:yearMonthDuration('P1Y2M')").execute( - ctx); + Sequence res = new Query("xs:dateTime('1981-12-31T12:05:35.1234567') + xs:yearMonthDuration('P1Y2M')").execute(ctx); ResultChecker.dCheck(new DateTime((short) 1983, (byte) 2, (byte) 28, (byte) 12, (byte) 5, 35123456, null), res); } @Test public void dateTimeAddYearMonthDuration2() { Sequence res = new Query("xs:dateTime('1981-12-12T12:05:35.1234567') + xs:yearMonthDuration('-P1Y1M')").execute( - ctx); + ctx); ResultChecker.dCheck(new DateTime((short) 1980, (byte) 11, (byte) 12, (byte) 12, (byte) 5, 35123456, null), res); } @Test public void dateTimeAddDayTImeDuration() { Sequence res = new Query("xs:dateTime('1981-12-12T12:05:35.1234567') + xs:dayTimeDuration('P19DT14H40.654321S')") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(new DateTime((short) 1982, (byte) 1, (byte) 1, (byte) 2, (byte) 6, 15777777, null), res); } @@ -243,14 +242,14 @@ public void castDateFromString2() { @Test public void subtractDateTimes() { Sequence res = new Query("xs:dateTime(\"2000-10-30T06:12:00\") - xs:dateTime(\"1999-11-28T09:00:00\")").execute( - ctx); + ctx); ResultChecker.dCheck(new DTD(false, (short) 336, (byte) 21, (byte) 12, 0), res); } @Test public void subtractDateTimes2() { Sequence res = new Query("xs:dateTime(\"2000-10-30T06:12:00\") - xs:dateTime(\"1999-11-28T09:00:00Z\")").execute( - ctx); + ctx); ResultChecker.dCheck(new DTD(false, (short) 336, (byte) 21, (byte) 12, 0), res); } diff --git a/src/test/java/io/brackit/query/expr/FLWORTest.java b/src/test/java/io/brackit/query/expr/FLWORTest.java index a178b52d..9f2e8e48 100644 --- a/src/test/java/io/brackit/query/expr/FLWORTest.java +++ b/src/test/java/io/brackit/query/expr/FLWORTest.java @@ -109,21 +109,21 @@ public void forExprThreeLetBindingsOneLetUnused() throws Exception { @Test public void forExprTwoLetBindingsWithWhereClause() throws Exception { Sequence result = new Query("for $a in (1,2,3) let $b:=4 let $c:= 1 where $a + $b + $c > 7 return $a + $b + $c") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(new Int32(8), result); } @Test public void forExprTwoLetBindingsWithOrderByRunVar() throws Exception { Sequence result = new Query("for $a in (3,2,1) let $b:=4 let $c:= 1 order by $a ascending return $a + $b + $c") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(intSequence(6, 7, 8), result); } @Test public void forExprTwoLetBindingsWithOrderByLetVarAndRunVar() throws Exception { Sequence result = new Query("for $a in (3,2,1) let $b:=4 let $c:= 1 order by $c, $a ascending return $a + $b + $c") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(intSequence(6, 7, 8), result); } @@ -154,14 +154,14 @@ public void nestedFor() throws Exception { @Test public void variableShadowingWithNormalize() throws Exception { Sequence result = new Query("for $a in (1,2,3) for $b in (for $a in (4,5,6) return $a) return $a + $b").execute( - ctx); + ctx); ResultChecker.dCheck(intSequence(5, 6, 7, 6, 7, 8, 7, 8, 9), result); } @Test public void nestedForWithAnotherForInNestedIn() throws Exception { Sequence result = new Query("for $a in (1,2,3) return for $b in (for $c in (4,5,6) return $c) return $a + $b") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(intSequence(5, 6, 7, 6, 7, 8, 7, 8, 9), result); } @@ -174,14 +174,14 @@ public void simpleLetExpr() throws Exception { @Test public void sequenceOfLetExpressions() throws Exception { Sequence result = new Query("let $a := (1,2,3) let $b := (4,5,6) let $c := (7,8,9) return ($a, $b, $c) ").execute( - ctx); + ctx); ResultChecker.dCheck(intSequence(1, 2, 3, 4, 5, 6, 7, 8, 9), result); } @Test public void sequenceOfLetAndForExpressions() throws Exception { Sequence result = new Query( - "let $a := (1,2,3) let $b := (4,5,6) let $c := (7,8,9) for $d in $a for $e in $b for $f in $c let $g := ($d + $f) return $d + $d + $f ").execute(ctx); + "let $a := (1,2,3) let $b := (4,5,6) let $c := (7,8,9) for $d in $a for $e in $b for $f in $c let $g := ($d + $f) return $d + $d + $f ").execute(ctx); Sequence ints = intSequence(9, 10, 11, diff --git a/src/test/java/io/brackit/query/expr/PrologDeclarationTest.java b/src/test/java/io/brackit/query/expr/PrologDeclarationTest.java index 4dee1241..33a2b474 100644 --- a/src/test/java/io/brackit/query/expr/PrologDeclarationTest.java +++ b/src/test/java/io/brackit/query/expr/PrologDeclarationTest.java @@ -59,14 +59,14 @@ public void declareFunction() { @Test public void declareRecursiveFunction() { Sequence res = new Query( - "declare function local:countdown($a as xs:integer) { if ($a > 0) then ($a, local:countdown($a - 1)) else $a }; local:countdown(3)").execute(ctx); + "declare function local:countdown($a as xs:integer) { if ($a > 0) then ($a, local:countdown($a - 1)) else $a }; local:countdown(3)").execute(ctx); ResultChecker.check(new ItemSequence(new Int32(3), new Int32(2), new Int32(1), new Int32(0)), res); } @Test public void declareIndirectRecursiveFunctions() { Sequence res = new Query( - "declare function local:a($a as xs:integer) { if ($a > 0) then ('a', $a, local:b($a - 1)) else ('a', $a) }; declare function local:b($b as xs:integer) { if ($b > 0) then ('b', $b, local:a($b - 1)) else ('b', $b) }; local:a(3)").execute(ctx); + "declare function local:a($a as xs:integer) { if ($a > 0) then ('a', $a, local:b($a - 1)) else ('a', $a) }; declare function local:b($b as xs:integer) { if ($b > 0) then ('b', $b, local:a($b - 1)) else ('b', $b) }; local:a(3)").execute(ctx); ResultChecker.check(new ItemSequence(new Str("a"), new Int32(3), new Str("b"), @@ -96,7 +96,7 @@ public void variableDeclarationWithAccess() { @Test public void twoVariableDeclarationsWithAccess() { Sequence result = new Query( - "declare variable $x := 1; declare variable $y := $x + 2; for $a in (1,2,3) return $a + $x + $y").execute(ctx); + "declare variable $x := 1; declare variable $y := $x + 2; for $a in (1,2,3) return $a + $x + $y").execute(ctx); ResultChecker.dCheck(new ItemSequence(new Int32(5), new Int32(6), new Int32(7)), result); } @@ -159,7 +159,7 @@ public void declareDefaultElementNS() { @Test public void declareDefaultFunctionNS() { Sequence result = new Query( - "declare default function namespace \"http://brackit.org/foo\"; declare function inc($i as xs:integer) { $i + 1 }; inc(1)").execute(ctx); + "declare default function namespace \"http://brackit.org/foo\"; declare function inc($i as xs:integer) { $i + 1 }; inc(1)").execute(ctx); ResultChecker.dCheck(new Int(2), result); } diff --git a/src/test/java/io/brackit/query/function/fn/FnTest.java b/src/test/java/io/brackit/query/function/fn/FnTest.java index 4fbcf142..53373d60 100644 --- a/src/test/java/io/brackit/query/function/fn/FnTest.java +++ b/src/test/java/io/brackit/query/function/fn/FnTest.java @@ -626,42 +626,42 @@ public void fnMatchesIrrelaventFlags() { @Test public void fnMatchesNoMatchSingleLine() { Sequence result = new Query( - "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'Kaum.*krähen')").execute(ctx); + "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'Kaum.*krähen')").execute(ctx); ResultChecker.dCheck(Bool.FALSE, result); } @Test public void fnMatchesMatchLineSpanning() { Sequence result = new Query( - "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'Kaum.*krähen', 's')").execute(ctx); + "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'Kaum.*krähen', 's')").execute(ctx); ResultChecker.dCheck(Bool.TRUE, result); } @Test public void fnMatchesNoMatchWholeInput() { Sequence result = new Query( - "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', '^Kaum.*gesehen,$')").execute(ctx); + "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', '^Kaum.*gesehen,$')").execute(ctx); ResultChecker.dCheck(Bool.FALSE, result); } @Test public void fnMatchesMatchWholeLine() { Sequence result = new Query( - "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', '^Kaum.*gesehen,$', 'm')").execute(ctx); + "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', '^Kaum.*gesehen,$', 'm')").execute(ctx); ResultChecker.dCheck(Bool.TRUE, result); } @Test public void fnMatchesIgnoreCase() { Sequence result = new Query( - "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'kaum', 'i')").execute(ctx); + "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'kaum', 'i')").execute(ctx); ResultChecker.dCheck(Bool.TRUE, result); } @Test public void fnMatchesIgnoreWhitespace() { Sequence result = new Query( - "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'K aum', 'x')").execute(ctx); + "fn:matches('Kaum hat dies der Hahn gesehen,\nFängt er auch schon an zu krähen:', 'K aum', 'x')").execute(ctx); ResultChecker.dCheck(Bool.TRUE, result); } @@ -1263,29 +1263,29 @@ public void fnTimezoneFromTimeEmpSeq() { @Test public void fnAdjustDateTimeToTimezoneEmptyTimezone() { - Sequence result = new Query("fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-05:00'), ())") - .execute(ctx); + Sequence result = new Query("fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-05:00'), ())").execute( + ctx); ResultChecker.dCheck(new io.brackit.query.atomic.DateTime("2002-03-07T10:00:00"), result); } @Test public void fnAdjustDateTimeToTimezone() { Sequence result = new Query( - "fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-05:00'), xs:dayTimeDuration('PT10H'))").execute(ctx); + "fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-05:00'), xs:dayTimeDuration('PT10H'))").execute(ctx); ResultChecker.dCheck(new io.brackit.query.atomic.DateTime("2002-03-08T01:00:00+10:00"), result); } @Test public void fnAdjustDateTimeToTimezoneWithoutTimezone() { Sequence result = new Query( - "fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'), xs:dayTimeDuration('PT10H'))").execute(ctx); + "fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00'), xs:dayTimeDuration('PT10H'))").execute(ctx); ResultChecker.dCheck(new io.brackit.query.atomic.DateTime("2002-03-07T10:00:00+10:00"), result); } @Test public void fnAdjustDateTimeToTimezoneImplicitTimezone() { Sequence result = new Query("fn:adjust-dateTime-to-timezone(xs:dateTime('2002-03-07T10:00:00-05:00'))").execute( - ctx); + ctx); ResultChecker.dCheck(new DateTime("2002-03-07T16:00:00+01:00"), result); } @@ -1313,15 +1313,15 @@ public void fnAdjustDateToTimezoneEmptyTimezone() { @Test public void fnAdjustDateToTimezone() { - Sequence result = new Query( - "fn:adjust-date-to-timezone(xs:date('2002-03-07-05:00'), xs:dayTimeDuration('-PT10H'))").execute(ctx); + Sequence result = new Query("fn:adjust-date-to-timezone(xs:date('2002-03-07-05:00'), xs:dayTimeDuration('-PT10H'))") + .execute(ctx); ResultChecker.dCheck(new Date("2002-03-06-10:00"), result); } @Test public void fnAdjustDateToTimezoneWithoutTimezone() { Sequence result = new Query("fn:adjust-date-to-timezone(xs:date('2002-03-07'), xs:dayTimeDuration('-PT10H'))") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(new Date("2002-03-07-10:00"), result); } @@ -1356,14 +1356,14 @@ public void fnAdjustTimeToTimezoneEmptyTimezone() { @Test public void fnAdjustTimeToTimezone() { Sequence result = new Query("fn:adjust-time-to-timezone(xs:time('10:00:00-05:00'), xs:dayTimeDuration('PT10H'))") - .execute(ctx); + .execute(ctx); ResultChecker.dCheck(new Time("01:00:00+10:00"), result); } @Test public void fnAdjustTimeToTimezoneWithoutTimezone() { - Sequence result = new Query("fn:adjust-time-to-timezone(xs:time('10:00:00'), xs:dayTimeDuration('PT10H'))") - .execute(ctx); + Sequence result = new Query("fn:adjust-time-to-timezone(xs:time('10:00:00'), xs:dayTimeDuration('PT10H'))").execute( + ctx); ResultChecker.dCheck(new Time("10:00:00+10:00"), result); } diff --git a/src/test/java/io/brackit/query/node/NodeTest.java b/src/test/java/io/brackit/query/node/NodeTest.java index 5fb379ec..c1160fbb 100644 --- a/src/test/java/io/brackit/query/node/NodeTest.java +++ b/src/test/java/io/brackit/query/node/NodeTest.java @@ -257,7 +257,9 @@ protected void checkSubtreePreOrder(final E node, org.w3c.dom.Node domNode) thro Text text = (Text) domNode; Assert.assertEquals(node + " is of type text : \"" + text.getNodeValue() + "\"", Kind.TEXT, node.getKind()); - Assert.assertEquals(String.format("Text of node %s", node), text.getNodeValue().trim(), node.getValue().stringValue()); + Assert.assertEquals(String.format("Text of node %s", node), + text.getNodeValue().trim(), + node.getValue().stringValue()); } else { throw new DocumentException("Unexpected dom node: %s", domNode.getClass()); } @@ -332,7 +334,9 @@ protected void checkSubtreePostOrder(E node, org.w3c.dom.Node domNode) throws Ex Text text = (Text) domNode; Assert.assertEquals(node + " is of type text", Kind.TEXT, node.getKind()); - Assert.assertEquals(String.format("Text of node %s", node), text.getNodeValue().trim(), node.getValue().stringValue()); + Assert.assertEquals(String.format("Text of node %s", node), + text.getNodeValue().trim(), + node.getValue().stringValue()); } else { throw new DocumentException("Unexpected dom node: %s", domNode.getClass()); } @@ -372,9 +376,10 @@ protected void compareAttributes(E node, Element element) throws Exception { E attribute = node.getAttribute(new QNm(domAttribute.getName())); assertNotNull(String.format("Attribute \"%s\" of node %s", domAttribute.getName(), node), attribute); Assert.assertEquals(attribute + " is of type attribute", Kind.ATTRIBUTE, attribute.getKind()); - Assert.assertEquals(String.format("Value of attribute \"%s\" (%s) of node %s", domAttribute.getName(), attribute, node), - domAttribute.getValue(), - attribute.getValue().stringValue()); + Assert.assertEquals(String.format("Value of attribute \"%s\" (%s) of node %s", + domAttribute.getName(), + attribute, + node), domAttribute.getValue(), attribute.getValue().stringValue()); } }